Page 1 of 1

[SOLVED]Combobox getSelectedItem

Posted: Sun Oct 11, 2009 22:50
by Tiblanc
Hi all!

I'm not sure if this is a bug or a feature. I have a combobox with various items and a method that is called every frame which takes the selected item of the combobox and uses it to calculate stuff. The getSelectedItem function appears to be returning the correct value when the combobox is not expanded. When it is, it will return whatever is under the mouse at that time or nothing if the mouse is not over any item.

So if I have A, B and C in my combobox, select A, expand the list and put the mouse over B without clicking, getSelectedItem will return B. Is this the correct behavior?

Re: Combobox getSelectedItem

Posted: Mon Oct 12, 2009 08:27
by scriptkid
Hi,

IIRC, this is by design. Being "selected" is merely a visual "true". An actual 'commit' doesn't take place until the user clicks the item, which triggers the CEGUI.Combobox.EventListSelectionAccepted event.

HTH.

Re: Combobox getSelectedItem

Posted: Mon Oct 12, 2009 14:31
by Tiblanc
Alright. If it's not a bug, I'll use this feature instead of creating a child class for my ComboDropList to get the item under the mouse cursor(viewtopic.php?f=10&t=4387). I was not sure if this would be fixed in a future release. That should simplify my code nicely!

Thanks!