> PS: just for the record I tried what Greg told me to do and I 
> still getting
> that error.. And I didn't really understand how this parent() 
> method is
> suppose to work. How can I create an hierarchy of widgets? Using the
> children() method? Or current()->add() method? I read the 
> manual but it is not clear to me..


There are certain widget types that are intended to act as "containers"
for other widgets, e.g Fl_Group and Fl_Window for example.

When you add() a widget to such a container, then it inherently becomes
a "child" of that "parent" widget.

So if you create a window then add a button to it...

        Fl_Window main_win(...);

        Fl_Button my_btn(...);

        main_win->add(my_btn);

Then if you were later to do:

        Fl_Group *get_parent = my_btn->parent();

The returned pointer "get_parent" here will actually be a pointer to
"main_win" (Fl_Window is derived form Fl_Group, so they are the same in
this case...)

So you can then do...

        (Fl_Window *)get_parent->some_other_function();

And so on...

http://www.fltk.org/doc-1.1/Fl_Widget.html#Fl_Widget.parent 


Similarly, if you have a container widget, you can ask it how many
childern it has...

http://www.fltk.org/doc-1.1/Fl_Group.html#Fl_Group.children 

Or even get a list of them...

http://www.fltk.org/doc-1.1/Fl_Group.html#Fl_Group.child 

Or search through that list for a specific widget...

http://www.fltk.org/doc-1.1/Fl_Group.html#Fl_Group.find 




SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to