> Iterating all children of an Fl_Group is easy. You can use children()
> to get the no. of children and use child(i) to get each child.
>
> > I need to look at each Fl_Check_Button in the group and ask something
> > like " if(chkBtn->value()) "
>
> Given the above, you will have to cast the widget pointer to a valid
> Fl_Check_Button* pointer, and that is the trickier part if you don't
> know which of the children are check buttons and which might be other
> widget types. FLTK doesn't use dynamic_cast, but if you can use it in
> your application (i.e. if you have the proper runtime support in your
> compiler/build environment), then you can use it, maybe like this:
Thanks for the info,
The group will only contain check buttons, given this is it safe to
do this?
for (int i=0; i < group->children(); i++)
{
Fl_Widget *w = group->child(i);
Fl_Check_Button* b = (Fl_Check_Button*)w;
if (b)
{
char v = b->value();
if(v = 1)
{
//it's selected
}
}
}
I know that asking if v = 1 is pretty ropey here but the docs say
value returns a char for check_button->value() and when i tried
asking for the char value like '1' it does not equate to one.
Equally the test using int v was not working.
I only need to know if it is selected.
There are rather a lot of the boxes so i would not name each one
unless it becomes neccesary, I may create them at runtime even
using an array.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk