Bambookit Home    Bambookit GUI Tutorial


III. Event-Handling

Chapter 11. Events

Multiple Events and/or Multiple Targets

Method signature

addActionTarget = "[String] widget name, [Constant] event,[Method] execute method,[String] widget name, [Constant] event,[Method] execute method"
[String] is the name of the widget. Different widget targets can be called
[Constant] the event to listen on
[Method] the method signature. The method values are placed in the single quotes. Special characters used within the single quotes has to be encoded using ASCII Table.
The encoding is the following:

" - double quotes -> " ' - single quotes -> ' % - percentage sign -> % & - ampersand -> & , - comma -> , + - plus -> +


Consider the following code snippet: 1 <Widget setShape="5,10,170,84" setBackground="4d99e5" setName="button"> 2 <Button setAnchor="true,true,false,false" setName="" setOpaque="false" 3 setShape="150,0,20,18" setFocusTraversable="false" setBorder="none" setVisible="true" 4 addActionTarget="button.minus,mousepressed,setVisible='true',,mousepressed,setVisible='false', 5 button,action,setMotionScript='scriptdown',,action,setLabel='&#43'"/> 6 </Widget> In the lines 4-5 multiple actions ('mousepressed' and 'action') and multiple targets( and button) are used. The actions are separated with a comma. The action that sets the button's label to encoded character '+' is used.