PDA

View Full Version : how to trap 'onselected' event on tabpanes ?


3wi
11-09-2004, 05:52 AM
I want to display dynamic views inside a tabpane each time it is selected.

I can do it once at init, trapping the 'oninit' event, but that's all.

I tried 'onselected' event, but it does not work on tabpanes, only one slides.


More generally, is there an event like the 'ondisplay' which would be triggered when a view becomes viewable on the screen ?

pablo
11-11-2004, 11:42 AM
Here's a workaround until tabpanes handle selection better:


<canvas debug="true">

<debug x="220" y="20" width="250" height="200" />

<class name="mytabpane" extends="tabpane" >
<method event="oninit">
if (this.tab.selected) Debug.write(this.text + ' selected');
</method>
<method event="onselect" reference="this.tab">
if (this.tab.selected) Debug.write(this.text + ' selected');
</method>
<view name="content" width="100" height="100" bgcolor="red" />
</class>


<tabs x="20" y="20">
<mytabpane text="one" />
<mytabpane text="two" />
<mytabpane text="three" />
</tabs>

</canvas>


Let me know how it goes!

pablo

3wi
11-11-2004, 11:58 AM
It works perfectly, as usual.

Thank's pablo.