Finally, the following code worked. Can you tell me why?
int main(int argc, char **argv)
{
// Fl_Group::current(NULL);
// Fl_Window *w = new Fl_Window(0,0,0,0);
Fl_Button *button1 = new Fl_Button(2,2,80,40,"Hello");
Fl_Group *flow_panel = new Fl_Group(2,2,100,100);
Fl_Group::current(flow_panel);
flow_panel->begin();
flow_panel->add(button1);
flow_panel->end();
Fl_Window *window = new Fl_Window(2,2,300,300);
Fl_Group::current(window);
window->begin();
window->add(flow_panel);
window->end();
window->show();
//flow_panel->show();
//button1->show();
Fl::run();
return 0;
}
Thanks & regards, Asif
On Tue, Jun 14, 2011 at 8:16 PM, asif saeed <[email protected]> wrote:
> Sorry, actually this is the code (previous code was just a mess after I
> randomly tried to make things work in vain):
>
>
> int main(int argc, char **argv)
> {
> Fl_Group::current(NULL);
> // Fl_Window *w = new Fl_Window(0,0,0,0);
>
>
> Fl_Group *flow_panel = new Fl_Group(2,2,100,100);
> Fl_Button *button1 = new Fl_Button(2,2,80,40,"Hello");
> Fl_Window *window = new Fl_Window(2,2,300,300);
>
> Fl_Group::current(flow_panel);
>
> flow_panel->begin();
> flow_panel->add(button1);
> flow_panel->end();
>
> Fl_Group::current(window);
>
> window->begin();
> window->add(flow_panel);
> window->end();
> window->show();
> //flow_panel->show();
> //button1->show();
>
> Fl::run();
>
> return 0;
> }
>
> Thanks in advance, Asif
>
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Jun 14, 2011 at 8:06 PM, asif saeed <[email protected]> wrote:
>
>> Thanks, Matthias. But the following shows nothing:
>>
>> int main(int argc, char **argv)
>> {
>> Fl_Window *w = new Fl_Window(0,0,0,0);
>>
>> Fl_Group *flow_panel = new Fl_Group(2,2,100,100);
>> Fl_Button *button1 = new Fl_Button(2,2,80,40,"Hello");
>> Fl_Window *window = new Fl_Window(2,2,300,300);
>>
>> Fl_Group::current(NULL);
>>
>> flow_panel->begin();
>> flow_panel->add(button1);
>> flow_panel->end();
>>
>> window->begin();
>> window->add(flow_panel);
>> window->end();
>> window->show();
>> flow_panel->show();
>> button1->show();
>>
>> Fl::run();
>>
>> 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