TextField¶
-
structure
TextField¶ TextFieldobjects are created viaBOX:ADDTEXTFIELD.A
TextFieldis a special kind ofLabelthat can be edited by the user. Unlike a normalLabel, aTextFieldcan only be textual (it can’t be used for image files).A
TextFieldhas a default style that looks different from a passiveLabel. In the default style, aTextFieldshows the area the user can click on and type into, using a recessed background.Suffix Type Description Every suffix of LABEL. Note you readLabel:TEXTto see the TextField’s current value.CHANGEDBooleanHas the text been edited? ONCHANGEKOSDelegate(String)Your function called whenever the CHANGEDstate changes.CONFIRMEDBooleanHas the user pressed Return in the field? ONCONFIRMKOSDelegate(String)Your function called whenever the CONFIRMEDstate changes.-
TextField:
CHANGED¶ Type: BooleanAccess: Get/Set Tells you whether
Label:TEXThas been edited at all since the last time you checked. Note that any edit counts. If a user is trying to type “123” into theTextFieldand has so far written “1” and has just pressed the “2”, then this will be true. If they then press “4” this will be true again. If they then press “backspace” because this was type, this will be true again. If they then press “3” this will be true again. Literally every edit to the text counts, even if the user has not finished using the textfield.As soon as you read this suffix and it returns true, it will be reset to false again until the next time an edit happens.
This suffix is intended to be used with the polling technique of widget interaction.
-
TextField:
ONCHANGE¶ Type: KOSDelegateAccess: Get/Set This
KOSDelegateexpects one parameter, aString, and returns nothing.This allows you to set a callback delegate to be called whenever the value of
Label:TEXTchanges in any way, whether that’s inserting a character or deleting a character.The
KOSDelegateyou use must be made to expect one parameter, the new string value, and return nothing.Example:
set myTextField:ONCHANGE to {parameter str. print "Value is now: " + str.}.
This suffix is intended to be used with the callback technique of widget interaction.
-
TextField:
CONFIRMED¶ Type: BooleanAccess: Get/Set Tells you whether the user is finished editing
Label:TEXTsince the last time you checked. This does not become true merely because the user typed one character into the field or deleted one character (unlikeCHANGED, which does). This only becomes true when the user does one of the following things:- Presses
EnterorReturnon the field. - Leaves the field (clicks on another field, tabs out, etc).
As soon as you read this suffix and it returns true, it will be reset to false again until the next time the user commits a change to this field.
This suffix is intended to be used with the polling technique of widget interaction.
- Presses
-
TextField:
ONCONFIRM¶ Type: KOSDelegateAccess: Get/Set This
KOSDelegateexpects one parameter, aString, and returns nothing.This allows you to set a callback delegate to be called whenever the user has finished editing
Label:TEXT. UnlikeCHANGED, this does not get called every time the user types a key into the field. It only gets called when one of the following things happens reasons:- User presses
EnterorReturnon the field. - User leaves the field (clicks on another field, tabs out, etc).
The
KOSDelegateyou use must be made to expect one parameter, the new string value, and return nothing.Example:
set myTextField:ONCONFIRM to {parameter str. print "Value is now: " + str.}.
This suffix is intended to be used with the callback technique of widget interaction.
- User presses
-
TextField: