PDA

View Full Version : strange issue with tabsliders


mmenti
07-15-2006, 04:38 AM
I've been struggling with tabsliders inside tabpanes, and have managed to cut down the issue a little (sample lzx code below).

Here's the issue: the second tabslider doesn't seem to be defined in script, so running the below says:
"reference to undefined variable 'ts_comm'"

If I swap the order of the tabpanes in the lzx, then the error changes to
"reference to undefined variable 'ts_attr'"

In other words, the tabslider in the first tabpane is defined, but the one in the second tabpane isn't..

Is this is a bug, or am I doing something stupid?

Thanks,
Mario.

sample lzx:

<canvas debug="true" width="1024" height="500">
<view width="500" name="myview">
<tabs name="mytabs" width="${parent.width}" height="480">
<tabpane id="tab_att" name="tab_att" text="Attributes">
<tabslider id="ts_attr" name="ts_attr" width="${parent.width-18}" height="${parent.height-18}">
<tabelement name="a" />
</tabslider>
</tabpane>
<tabpane id="tab_comm" name="tab_comm" text="Comments">
<tabslider id="ts_comm" name="ts_comm" width="${parent.width-18}" height="${parent.height-18}">
<tabelement name="a" />
</tabslider>
</tabpane>
<handler name="oninit">
Debug.write(ts_comm);
Debug.write(ts_attr);
</handler>
</tabs>
</view>
</canvas>

mmenti
07-15-2006, 08:56 AM
OK, I think I figured this out myself (so the answer to "bug or stupid me?" is clearly "stupid me"..)

I guess the second tabslider hasn't actually finished instantiating when the script is called. I'll probably just need to add something to the "oninit" handler of the last tabslider in order to know that it's been instantiated, or is there a better way?