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();
   }
};
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to