III. Event-Handling
Chapter 11. Events
Forwardspace
Quick Reference Guide
Method signature
addActionTarget = "
[String] widget name,
[Constant] event,
[Method] execute method"
[String] is the name of the widget
[Constant] the event to listen on
[Method] the method signature
Examples
A forwardspace event only occurs in Edit controls.
Once the Label length is reached any subsequent inserts generates the forwardspace event.
If the caret is at the end of the label and the right arrow key is pressed, then the forwardspace event is generated.
To demostrate the forwardspace event, on the forwardspace event we will request focus to the next widget,
and on the backspace event we will request focus to the previous widget
<Widget setShape="0,0,100,80">
<Edit setShape="10,5,80,20" setName="edit1" setLabelLength="10"/>
<Edit setShape="10,30,80,20" setName="edit2" setLabel="event here" setLabelLength="10"
addActionTarget="this,forwardspace,requestFocus='edit3',this,backspace,requestFocus='edit1'"/>
<Edit setShape="10,55,80,20" setName="edit3" setLabelLength="10"/>
</Widget>
The Widget, 'edit2', will execute the method 'requestFocus'
On the forwardspace event we execute edit2.requestFocus="edit3", the Widget 'edit3' gains focus
On the backspace event we execute edit2.requestFocus="edit1", the Widget 'edit1' gains focus
To handle more than one event, we append them to the addActionTarget, the addActionTarget accepts parameters in tuples (3,6,9,etc...)
Back
Next