Page 1 of 1

setSelected for ComboBox

Posted: Wed Jul 16, 2008 23:58
by earthsruler
When you call set selected on the combo box, it doesn't simultaneously set the text of the edit box the combo box uses. as a result you have to say something like:


Code: Select all


local item = comboBox:findItemWithText( "OMG", nil )
comboBox:setItemSelectState( item, true )
comboBox:getEditbox():setText( "OMG" )



This should happen automatically when the item is set as selected.

Cheers.
ER.

Posted: Thu Jul 17, 2008 08:18
by CrazyEddie
Hi,

This omission is largely due to the way the Combobox used to be regarded - whereby the list and 'selected item' was only relevant when the list was visible - although I changed my mind about that earlier this year.

Thanks for the report, action will be taken shortly ;)

CE.

Posted: Thu Jul 17, 2008 16:54
by Jamarr
Confirmed. I didn't even think about mentioning this when I ran into this issue. It's fairly easy to work around, though:

Code: Select all

CEGUI::ListboxItem* pItem = _pCombo->getDropList()->getFirstSelectedItem();
_pCombo->getEditbox()->setText(pItem->getText());