Bambookit Home    Bambookit GUI Tutorial

Back    Next   

III. Event-Handling

Chapter 11. Events

Focus Lost

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


A focus lost event occurs when a widget loses focus.

A widget that is focusTraversable will be highlighted by a blue border. When a widget loses focus, either by tab traversal, or mouse selection, or OS request then and event gets thrown indicating that it has 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'"/>

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