>     This is because only the w/h values are specified; to make
>     a window a widget inside the other, the x/y/w/h values need
>     to be specified.

    ..and just to clarify, by that I mean when creating the second window
    "new Fl_Window(w,h)" makes a separate window, whereas
    "new Fl_Window(x,y,w,h)" makes it a subwindow (widget inside outer window)

    So in other words this should work:

#include <FL/Fl_Double_Window.H>
#include <FL/Fl.H>
#include <iostream>

class MyWindow : public Fl_Double_Window {
public:
     MyWindow(int w, int h, char const* label = 0)
             : Fl_Double_Window(w, h, label)
     {;}
     MyWindow(int x, int y, int w, int h, char const* label = 0)        // ADDED
             : Fl_Double_Window(x, y, w, h, label)               // ADDED
     {;}                                                         // ADDED
     ~MyWindow() { std::cout << "Deleted " << label() << std::endl; }
};
int main()
{
     MyWindow* win1 = new MyWindow(300, 300, "Window 1");
     MyWindow* win2 = new MyWindow(0,0,300, 300, "Window 2"); // CHANGED
     win2->end();
     // win2->parent(0);
     win1->end();
     delete win1;
     return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to