On 14.06.2011, at 17:06, asif saeed wrote:
> Thanks, Matthias. But the following shows nothing:
>
> int main(int argc, char **argv)
> {
> Fl_Window *w = new Fl_Window(0,0,0,0);
Here, you create a window that is 0 pixels wide and 0 pixels high. You never
use it later, but by creating it, you start a Group. All following widgets will
be added to the group.
> Fl_Group *flow_panel = new Fl_Group(2,2,100,100);
The flow panel is now inside the window "w". flow_panel is now current.
> Fl_Button *button1 = new Fl_Button(2,2,80,40,"Hello");
button1 is now a child of flow_panel which is a child of w
> Fl_Window *window = new Fl_Window(2,2,300,300);
"window" is also a child of flow_panel now which is a child of w. It's a
subwindow that starts a new coordinate system at 0, 0. "window" is also current.
> Fl_Group::current(NULL);
OK, now no widgets will be added automatically
> flow_panel->begin();
This call is not needed because you down't create a ny new widgets
> flow_panel->add(button1);
button1 is already a child of flow_panel, so nothing happens here
> flow_panel->end();
This call is not needed. It makes the parent of flow_panel "current", i.e. "w'
>
> window->begin();
not needed.
> window->add(flow_panel);
this works, but messes up everything: "window" is a child of "flow_panel". By
adding "flow_panel" to "window", you remove it from "w" and create a circular
dependency.
> window->end();
Not needed.
> window->show();
"window" is still a subwindow of "w". Showing it does nothing.
> flow_panel->show();
Same here.
> button1->show();
Same here.
>
> Fl::run();
You have no visible toplevel window ("w" would be the only one), so your app
just quits
>
> return 0;
> }
>
>
> On Tue, Jun 14, 2011 at 7:33 PM, Matthias Melcher <[email protected]> wrote:
>
>>
>> PS: starting a new Group or Group derive widget (including a Window) makes
>> that group the "current" one. Everything that is created after this will be
>> added to the group. You can avoid this by calling Fl_Group::current(0L);
>>
>>
>> _______________________________________________
>> fltk mailing list
>> [email protected]
>> http://lists.easysw.com/mailman/listinfo/fltk
>>
> _______________________________________________
> fltk mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk