Bambookit Home    Bambookit GUI Tutorial

Back    Next   

III. Event-Handling

Chapter 11. Events


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


A documentdone event only occurs after a loadGui invocation and this occurs once the XML document has been downloaded.

To demostrate the documentdone event, we will load the focusgained.xml script into the 'loadhere' panel. When we start loading the document the status bar will change its label to "loading", once loaded the documentdone event is received and the status bar will change its label to "loaded"

<Widget setShape="0,0,200,80">
<Button setShape="10,10,80,25" setLabel="load" addActionTarget="loadhere,action,loadGui='focusgained.xml%2cfalse',status,action,setLabel='loading'"/>
<Widget setShape="10,55,80,20" setName="status" setBorder="squareloweredthin"/>
<Widget setShape="100,0,100,80" setName="loadhere" addActionTarget="status,documentdone,setLabel='loaded'" setCache="false"/>

The Widget, 'loadhere', will execute the method 'loadGui'
On the documentdone event we execute status.setLabel="loaded"
To handle more than one event, we append them to the addActionTarget, the addActionTarget accepts parameters in tuples (3,6,9,etc...)


Remember to setCache="false" if you wish to download dynamically generated documents instead of static documents. The documentdone event is NOT thrown for cached panels that get reloaded.

Back    Next