On 05/23/12 10:29, David Currie wrote: > MyTextWindow(int W, int H,const char* l) > : Fl_Window(W,H,l), MyTextDisplay(20,20,W-40,H-40,NULL) > { > Fl_Window::label(l); > Fl_Window::add(this); // Compile error : ambiguous base class Fl_Widget
Don't even do the add(); it's not needed. (**) FWIW, I wouldn't use multiple inheritance anyway, I'd just derive from Fl_Window, and make MyTextDisplay a protected/private member, and provide methods to manipulate the member separately, or provide a single method that lets app code access it directly. That's the common technique in FLTK apps, and is indeed how FLTK implements its own derived widgets. ** add() is implied because Fl_Window::begin() is implied, which handles add()ing all widgets that follow automatically until an end(). So for instance, the following code: Fl_Window win(..); MyTextDisplay myt(..); win.end(); ..really ends up being: Fl_Window win(..); win.begin(); // THIS IS IMPLIED MyTextDisplay myt(..); // automatically a child of the win due to implied win.begin() win.end(); // end() the auto-parenting behavior of the Fl_Window .. ..which by definition does an add() already, so including an add() after the MyTextDisplay declaration is redundant. _______________________________________________ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev