Page 1 of 1

Does "setText" keep Combobox items ordered?

Posted: Sun Dec 16, 2007 12:15
by Dirso
Hi,

If I store a pointer for each CEGUI::ListboxTextItem that I add to my combobox and if I have to change their text - for translation purposes for example, will it stay sorted? I'm asking because it's not sorted with me. :(

Thanks,
Dirso.

Posted: Sun Dec 16, 2007 18:06
by scriptkid
Hi,

Combox has a method 'handleUpdatedListItemData()', which -i think- should do what you want. Because its documentation reads: "Causes the list box to update it's internal state after changes have been made to one or more attached ListboxItem objects.".

HTH.

Posted: Mon Dec 17, 2007 01:35
by Dirso
Still not working :(
To make it sorted (when I start) I'm using this:

Code: Select all

static_cast<CEGUI::Combobox*>(getWindow(ID))->setSortingEnabled(true);

Am I right?

Thanks,
Dirso

Posted: Mon Dec 17, 2007 13:41
by scriptkid
Hi,

yeah that looks okay. I checked the code, and (re)sorting is not a part of the update method i mentioned. I've added this to Mantis. A workaround would be to cause a resort manually by saying:

Code: Select all

static_cast<CEGUI::Combobox*>(getWindow(ID))->setSortingEnabled(false);
static_cast<CEGUI::Combobox*>(getWindow(ID))->setSortingEnabled(true);


but i noticed that the (re)sort will sort from high to low, which is not correct i think. If you use SVN, the fix has already been made (so you can use the workaround).

Otherwise you have to wait for an update, and re-add the items yourself.

Sorry ;)

Posted: Sat Dec 29, 2007 14:02
by Dirso
scriptkid wrote:Hi,

yeah that looks okay. I checked the code, and (re)sorting is not a part of the update method i mentioned. I've added this to Mantis. A workaround would be to cause a resort manually by saying:

Code: Select all

static_cast<CEGUI::Combobox*>(getWindow(ID))->setSortingEnabled(false);
static_cast<CEGUI::Combobox*>(getWindow(ID))->setSortingEnabled(true);


but i noticed that the (re)sort will sort from high to low, which is not correct i think. If you use SVN, the fix has already been made (so you can use the workaround).

Otherwise you have to wait for an update, and re-add the items yourself.

Sorry ;)

Since I use OgreSDK, the better choice would be wait for the next release, right?

Thanks again,
Dirso

Posted: Sat Dec 29, 2007 16:33
by scriptkid
Yes, i would recommend that. Note that we are currently in the process of creating new releases.

Posted: Mon Feb 11, 2008 12:58
by CrazyEddie
This is now fixed in svn trunk rev. 1540.

CE