PDA

View Full Version : Sending click event


mleising
08-07-2003, 01:16 AM
How do I send a click event manually on a tabelement?

I have a tabslider with two tabelements and I want to have the tabslider display initially with the first tab displayed open as the initial state. I thought I could do this by using the "oninit" method on the tabslider and sending the click event for tab 1.

Thanks...

antun
08-07-2003, 03:23 AM
I don't know if I'm doing somethign wrong or if there's a bug there. In any case, here's a workaround:


<canvas debug="true">
<include href="lz/tabslider.lzx" />
<tabslider name="foo" bgcolor="yellow" width="100"
height="200" mintabheight="40"
spacing="2" slideduration="300"
oninit="this.openTab(this.two, true)">
<tabelement bgcolor="red" width="100%" />
<tabelement name="two" bgcolor="red" width="100%" />
<tabelement bgcolor="red" width="100%" />
</tabslider>
</canvas>


Calling the openTab() method from the init of the tabslider is better than from one of the elements, because the oninit event fires after all of its subviews have finished initializing (i.e. after all the elements are in place).

If you're wondering where I got the openTab() method from, you can see the source code for tabslider in your installation:

WEB-INF/lps/components/lz/tabslider.lzx

FYI, you can send specific events using the sendEvent() method:

http://www.laszlosystems.com/developers/learn/documentation/lzxref/event.php#meth-sendEvent

-Antun

antun
08-07-2003, 03:46 AM
OK, I found out more on opennedTab - it doesn't actually work, although it does show up in the LZX Reference documentation.

I've filed a bug to this effect.

Also, the second attribute of the openTab() method determines whether it should animate or not, so if you don't want to see the animation, you could say:


this.openTab(this.two, false)


-Antun