> So here's the constructor of my widget:
> ... snip ...
> the pb is that only the first window is shown and I don't understand why.

Two problems that I can see:
1. container1 is an Fl_Double_Window, so when you create it, it becomes
   the current group, so container2 is added to container1 and not to
   your MySplitter widget. Add an end() after container1->color line
   and a begin() before the container2 allocation.
2. container2's x-position should be x + w/2, no?

The following appears to work for me.
D.

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

class MySplitter : public Fl_Group
{
public:
  MySplitter(int x, int y, int w, int h, const char *l = 0)
    : Fl_Group(x, y, w, h, l)
  {
    begin();
    container1 = new Fl_Double_Window(x, y, w / 2, h);
    container1->set_non_modal();
    container1->box(FL_DOWN_BOX);
    container1->color((Fl_Color) FL_RED);
    end();   // <- added

    begin(); // <- added
    container2 = new Fl_Double_Window(x + w / 2, y, w / 2, h); // <- changed
    container2->set_non_modal();
    container2->box(FL_DOWN_BOX);
    container2->color((Fl_Color) FL_BLUE);
    end();
  }

  Fl_Double_Window* container1;
  Fl_Double_Window* container2;
};

int main(int argc, char* argv[])
{
  Fl_Double_Window* myWin = new Fl_Double_Window(50, 50, 200, 200, "MyWin");
  MySplitter* mySplit = new MySplitter(60, 60, 90, 90, "MySplit");
  myWin->end();

  myWin->show(argc, argv);
  return Fl::run();
}

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to