Bambookit Home    Bambookit GUI Tutorial

Back    Next   

III. Event-Handling

Chapter 11. Events




Backspace

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 backspace event only occurs in Edit controls. If the caret is at the start of the label and the backpace key is pressed, then the backspace event is generated. If the caret is at the start of the label and the left arrow key is pressed, then the backspace event is generated.


To demostrate the backspace 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