On 21.08.2011, at 20:30, Greg Ercolano wrote:

> On 08/21/11 09:22, 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?
> 
>       begin() and end() are the way to control this.
> 
>       If you end() the parent window, for instance, then widgets
>       will be created but not attached to a parent, in which case
>       to attach them, you can use the appropriate Fl_Group::add(Fl_Widget*)
>       to parent them, which is something you should do quickly, otherwise
>       the widget might pop up in a window of its own.

No, sorry, that's not true. Fl_Group::end() basically calls begin() on the 
parent group, for example:

group1 = new Fl_Group();
  btn1 = new Fl_Button();
  group2 = new Fl_Group();
    btn2 = new Fl_Button();
  group2->end();
  btn3 = new Fl_Button();
group1->end();

btn3 will be added to group1, as indicated by the indentation.

The only way to temporarily disable auto-adding is calling 
Fl_Group::current(0L) right after creating any group style widget.

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

Reply via email to