Anirban wrote:
>> Anirban wrote:
>>> I am stuck up with a problem where I am supposed to create a form on a
>>> window on the call of a user defined class constructor. The constructor
>>> will be called when a button will be pressed(in the main window).
>>> I am using fltk v1.1.7 .
>>> Do I have to make my class inherit any thing.
>> You can create windows and widgets from the constructor
>> even if the class in question doesn't inherit from anything.
>>
>> For instance:
>>
>> class Foo { // plain class
>> Fl_Window *win;
>> Fl_Button *but;
>> public:
>> Foo() { // CONSTRUCTOR
>> win = new Fl_Window(400,400);
>> but = new Fl_Button(..);
>> win->end();
>> }
>> };
>>
>> Or you can inherit from e.g. Fl_Window to do the same thing
>> more or less:
>>
>> class Foo : public Fl_Window {
>> Fl_Button *but;
>> public:
>> Foo(int W, int H, const char *L=0) : Fl_Window(W,H,L) { //
>> CONSTRUCTOR
>> but = new Fl_Button(..);
>> end();
>> }
>> };
>
> end() doesn't seem to belong to FLTK 1.1.7 .
end() should be a method of Fl_Window, and you definitely
should call it in your constructor when done adding widgets
to the window.
> I tried all possible ways to popup new widgets(as in demo.cxx)but it won't
> show up on the screen.
Don't forget to show() the window when you want the window to actually
open. You could add:
win->show();
..to the constructor.
If you still have trouble, show us what you have so far.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk