Page 1 of 1

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

Posted: Mon Jun 29, 2009 06:23
by lcy03406
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?

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

Posted: Tue Jun 30, 2009 08:59
by CrazyEddie
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

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

Posted: Tue Jun 30, 2009 16:52
by Jamarr
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.

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

Posted: Wed Jul 01, 2009 09:31
by lcy03406
Finally i decide to register an event handler for ItemEntry::EventSelectionChanged on EVERY item of the list. :shock: