Bambookit Home    Bambookit GUI Tutorial

Back    Next   

III. Event-Handling

Chapter 11. Events




Focus Gained


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 focus gained event occurs when a widget gains focus (highlighted by blue border).


A widget that is focusTraversable will be highlighted by a blue border. When a widget gains focus, either by tab traversal, or mouse selection then and event gets thrown indicating that it has gained or lost focus



<Widget setShape="0,0,100,80">
<Widget setShape="10,10,80,25" setLabel="Popup" setName="popup" setBorder="flat" setVisible="false"/>
<Button setShape="5,40,40,25" setLabel="Other" />
<Button setShape="50,40,45,25" setLabel="Focus" setName="focus" addActionTarget="popup,focusgained,setVisible='true',popup,focuslost,setVisible='false'"/>
</Widget>

The Widget, 'popup', will execute the method 'setVisible'
On the focusgained event we execute popup.setVisible="true", the Widget Pops up
On the focuslost event we execute popup.setVisible="false", the Widget Pops down
To handle more than one event, we append them to the addActionTarget, the addActionTarget accepts parameters in tuples (3,6,9,etc...)



Back    Next