Hello Mike,

1. The SelectBox has the selection Model "one" which means that always  
one item has to be selected. This is like in HTML and is how I would  
suppose it to be. I can't imagine having nothing selected because I  
dont know how to visualize it to the user. If you want an "empty"  
selection, you could add an empty item and use that. Thats one way i  
can imagine right now how to get that from a GUI perspective.
Back to the original question... As long as no list item is in the  
select box, we do have some kind of irregular state because nothing  
can be selected. But as soon as the first element is reached in via  
the add method, this will be selected and the GUI will visualize it as  
selected. So the selection changes and a changeSelection event will be  
fired.
But a check for that should not be so much ugly code. Just check if  
the old selection is null and your done. Could that work for you too?

2. The event is named changeSelection because thats what he should  
signal. He should be fired if the selection changes. But if you click  
on the same item again, the selection is still the same so it did not  
change. Why should a changeSelection event be fired if the selection  
did not change? I guess you need something like a clickOnListItem  
event. But we dont have such an event. The solution for you could be  
that you add a click listener to the currently selected list item  
which can do the same thing as on a selection change.

What's interesting for us framework developers is what use case you  
have that you need those two features? Perhaps these are common use  
cases we just didn't see in our design and we need to add some more  
flexibility to the select box implementation.

Best,
Martin

Am 17.06.2009 um 19:03 schrieb mshillin:

>
> I am finding the new Selection API really hard to work with.
>
> 1. ChangeSelection events and Add.
>
> It appears SelectBox is firing a ChangeSelection event when the first
> ListItem is added.  I am using the trunk (0.8.3-pre) version.
>
> I would expect a ChangeSelection event to be triggered by a call to
> setSelection(), but not by an add().
>
> Seems like a bug to me.
>
> To get around this, I am writing a bunch of ugly conditional logic  
> in the
> ChangeSelection handlers associated with many of my SelectBoxes.
>
> I guess I could add/remove the listener too, but that seems even more
> convoluted.
>
>
> 2. setSelection() does not fire the ChangeSelection event if the  
> current
> selection is the same as what I am trying to set.  To get the event  
> to fire,
> I need to  resetSelection() then call setSelection().  But if I do  
> this, 2
> events are fired.
>
>
> It looks like the SelectBox is always automatically forcing a  
> selection.  Is
> it impossible to have an empty selection?
>
>
> Attached is an example of what I mean (Application.js)
>
> 1. press the "Add 5 Items" button and you will see a selection event  
> for
> "Item 0".  IMO this should not occur - now the first items is selected
>
> 2. press the "Select First" to select the first item - no  
> changeSelection
> event is fired - IMO the event should fire - because I explicitly  
> executed a
> setSelection().
>
> 3. press "Select Last" - this works as expected.
>
> 4. press "Reset Current Selection" - In an attempt to over come the
> limitations of re-selecting the current selection, I save the current
> selection, call resetSelection(), then call setSelection() with the
> previously saved selected item - now I get two events (one for Item0  
> and one
> for Item5).
>
> For simple use cases, this API probably works ok, but using it with  
> dynamic
> data or moderately complex event handling it is really klunky.
>
> Mike
> -- 
> View this message in context: 
> http://www.nabble.com/SelectionAPI-woes-%28part-1%29-tp24077884p24077884.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to