On 21.08.2011, at 18:21, asif saeed wrote:

> Hi,
> 
> Is there any way I could prevent my widgets from getting added to fltk
> groups automatically and have the ability to add fltk widgets to fltk groups
> myself - dynamically?

Yes. After creating a widget derived from Fl_Group, call Fl_Group::current(0L); 
and all widgets created afterwards will have no parent. You can then call 
myGroup->add(myWidget); etc. . Use myGroup->begin(); to re-enable auto-adding.

http://www.fltk.org/doc-1.3/classFl__Group.html

void    add (Fl_Widget &)
        The widget is removed from its current group (if any) and then added to 
the end of this group. 
void    add (Fl_Widget *o)
        See void Fl_Group::add(Fl_Widget &w) 
void    add_resizable (Fl_Widget &o)
        Adds a widget to the group and makes it the resizable widget. 
void    clear ()
        Deletes all child widgets from memory recursively. 
void    insert (Fl_Widget &, int i)
        The widget is removed from its current group (if any) and then inserted 
into this group. 
void    insert (Fl_Widget &o, Fl_Widget *before)
        This does insert(w, find(before)). 
void    remove (int index)
        Removes the widget at index from the group but does not delete it. 
void    remove (Fl_Widget &)
        Removes a widget from the group but does not delete it. 
void    remove (Fl_Widget *o)
        Removes the widget o from the group. 


void    begin ()
        Sets the current group so you can build the widget tree by just 
constructing the widgets. 
void    end ()
        Exactly the same as current(this->parent()). 

static Fl_Group *       current ()
        Returns the currently active group. 
static void     current (Fl_Group *g)
        Sets the current group. 

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to