[solved]Howto inform child widgets about the Selected state?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

[solved]Howto inform child widgets about the Selected state?

Postby lcy03406 » Mon Jun 29, 2009 06:23

Hi again, here a new problem with child widgets. :(
I add a RadioButton (and some other widgets) on a ItemEntry, and i want the RadionButton be in the same "Selected" state with it's parent - the ItemEntry, in a ItemListbox. It seems not automatically. And I have to write codes to trace the last selected RadionButton and de-select it. Any better solution?
Last edited by lcy03406 on Wed Jul 01, 2009 09:32, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [help]How to inform child widgets about the Selected state?

Postby CrazyEddie » Tue Jun 30, 2009 08:59

The deselection algorithm only works on the immediate parent, which obviously is not helpful when your widgets are children of ItemEntry windows so they can be added to the ItemListbox. From this, you should gather that currently, to manually go through and deselect the other radio buttons in the group is the only solution :(

CE

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: [help]How to inform child widgets about the Selected state?

Postby Jamarr » Tue Jun 30, 2009 16:52

By 'trace' I am assuming you mean 'iterate'; instead of iterating over all the radiobuttons looking for the selected one, whenever one is selected store a pointer to it as a member of your class; then when a radiobutton or listitem is selected, you already know which one (if any) to deselect.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

Re: [help]How to inform child widgets about the Selected state?

Postby lcy03406 » Wed Jul 01, 2009 09:31

Finally i decide to register an event handler for ItemEntry::EventSelectionChanged on EVERY item of the list. :shock:


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests