>> But [ type() ] doesn't transform Fl_Browser to Fl_Select_Browser, does it ?
>
>       Yep, that's what it does.
>
>       If you look at the source for FL/Fl_Select_Browser.H,
>       you'll see it just subclasses Fl_Browser and changes the type()
>       to FL_SELECT_BROWSER:
>
> class FL_EXPORT Fl_Select_Browser : public Fl_Browser {
> public:
>    Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0)
>          : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
> };

Oh…

I think i'm beginning to understand.
As i mix fluid generated code and my own functions, i receive all 
objects as «superclass» Fl_Widget.

Then, i've to ensure i can call specialized methods on them.

// with «Fl_Widget *w»
if (Fl_Select_Browser *b = dynamic_cast<Fl_Select_Browser *>(w)) {
        // it usually works , but not this time with Fl_Select_Browser
}

Here, w is still a «Fl_Browser» and cannot be subclassed to 
Fl_Select_Browser.
Well, that's what i guess (i'm not a C++ guru even if i try and improve ;) )

Thank you for your help.

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

Reply via email to