Sebastian Werner wrote:
> Normally qooxdoo uses selection managers for this things.
> This means "getManager" on your gallery instance should give
> you the selection manager. Then you can use getSelectedItems
> to get a list of selected elements.
D'oh! I should have guessed this from the ListView example.
As it turns out, getting the selectedItem from the SelectionManager
of a Gallery is not all that interesting -- it is a DIV object.
So here's a quick rundown of how I work with the selection:
- when you build your array to initialize the gallery, keep a
reference to this array
- when you want to get the selected image out of the gallery,
do this:
var mgr = gal.getManager();
var browseimgs = mgr.getItems();
for (i = 0; i < browseimgs.length; i++)
{
var itm = browseimgs[i];
if (mgr.getItemSelected(itm))
{
selected_image = gallery_images[i];
}
}
(this assumes that the QxGallery is in a variable "gal", and the
array used to initialize gal is "gallery_images")
Follow-up question: how can you add or remove images from a gallery
or a gallery list? My current solution involves building a new gallery,
but that seems horribly inefficient.
Jason Priebe
CBC New Media
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel