The ui class on an object is used to control it's user interface properties.
Properties
Applicable to text objects...
textBoundWidth |
A floating point value specifying the width of the whole text box in units. Set to zero to just match the actual text size. |
textBackgroundCol |
A Color to be used to draw the background. |
textBorderCol |
A Color to be used to draw the border. |
textCursorCol |
A Color to be used to draw the cursor. |
textSelectionForegroundCol |
A Color to be used to draw selected text. |
textSelectionBackgroundCol |
A Color to be used to draw behind selected text. |
textMinimumWidth |
The smallest size the input box can be (defaults to 1.0). |
textWrapWidth |
The width at which text will wrap onto multiple lines. |
textMaxChars |
The maximum number of text characters allowed in a string (default to 0 for unlimited). |
inputFilter |
If this string is set to a non-empty value, it will restrict input to those characters given in the string (e.g. pass "0123456789" for a number only entry. |
passwordChar |
If this string is set to a non-empty value, it will display this character in place of what's actually being stored. e.g. "*" would display asterisks to hide a password. |
inputType |
Gets/sets the string input type for the UI element. Currently "text" or "drop". |
listSelectedIndex |
Gets or sets the selected index in the list (integer). Is less than zero if nothing selected. |
maxRows |
A float that determines the maximum number of rows to display before scrolling occurs (currently in a drop list only). e.g. 12.0 |
buttonNormalBitmap |
A string id of the bitmap to use normally in a bitmapbutton. |
buttonHoverBitmap |
A string id of the bitmap to use in hover mode in a bitmapbutton. |
buttonHoverSound |
A string id of the sound to play in hover mode in a bitmapbutton. |
buttonHoverTransitionPeriod |
A float determining how quickly the hover bitmap is faded in (0 is instant). |
buttonDownBitmap |
A string id of the bitmap to use in down mode in a bitmapbutton. |
buttonDownSound |
A string id of the sound to play in hover mode in a bitmapbutton. |
buttonDownTransitionPeriod |
A float determining how quickly the down bitmap is faded in (0 is instant). |
Applicable to 3D objects...
mouseLook |
Set to true for a 3D object and the mouse will control its direction (active immediately). |
mouseLookAlways |
If true the mouse-look will operate without having to hold down the right mouse button. |
mouseLookMin |
The minimum pitch allowed for the mouse-look in degrees (defaults to -90). |
mouseLookMax |
The maximum pitch allowed for the mouse-look in degrees (defaults to 90). |
cursorKeyMove |
Set to true for a 3D object and the keyboard will control the forward/back/left/right motion (active immediately). |
cursorKeyMoveSpeed |
A float for the cruising speed for the object. |
cursorKeyMoveSoften |
A float that determines the curve on reaching the cruising speed. |
Methods
inputBegin() |
Call this method to begin user input on the object |
inputEnd() |
Call this method to end user input on the object |
listClear() |
Empties the list (if the inputType="drop"). |
listAdd(label) |
Adds the string label to the list. (if the inputType="drop"). Query object.text for the selected string, or object.ui.listSelectedIndex for the index. |
Examples
function onClick()
{
object.textBackgroundCol=new Color("#999999"); // set the background of the text to grey
object.ui.inputBegin(); // start text input
}
function onInputBegin()
{
print("Editing text...");
}
function onInputEnd()
{
print("Finished editing text! Got "+object.text);
}
Remarks
The text string being edited is always available via the object.text property.
See Also


