On Tue, Mar 16, 2010 at 11:58, Matthew Devine <[email protected]>wrote:
> So I’m trying to configure my application to know which tab I’ve selected
> so I can basically process something depending on the tab. In the
> following playground link, you are able to see the indexOf returns as I
> would expect it expect in the addListener. In my addListener, the return
> from e.getData() shows me that I am getting back the Page for my selected
> tab but for some reason indexOf always errors with -1. Any help would be
> appreciated, I have a feeling its something I’m overlooking. For some
> reason I couldn’t use the provided shorten URL or bit.ly kept saying it
> was invalid.
>
> http://tiny.cc/WAqic
>
> That was a hard problem to find (yet again!). The problem is that in the
process of solving one problem (multiple interfaces for dealing with
selections) a much greater problem was created. All selection functions now
return an ARRAY of selections, even when it is impossible for multiple items
to be returned. The problem is that e.getData() for the "changeSelection"
event returns a selection ARRAY. This is silly (nay, ridiculous), and one of
the few design decisions made by the core team that I seriously disagree
with... because it causes a complete waste of time for all of us as we try
to figure out why the obvious way to do something doesn't work.
In your case, you need to change your event listener like this:
tabView.addListener("changeSelection", function(e) {
doc.debug("Event Data:"+e.getData()[0]);
doc.debug("tabView indexOf:"+tabView.indexOf(e.getData()[0]));
});
Note that the (one and only) selection is in e.getData()[0]
Cheers,
Derrell
p.s. the bit.ly shortening doesn't work because that shortner site has a
limitation of 1024 bytes (or something like that) to the URL length. There
is a current bug report to replace bit.ly with something that works better
for this purpose.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel