You are giving an explanation that makes sense by one side but by other
side why it's implemented this way (I mean a bit crazy):
-If the code assumes that user_data is making a circular reference to
"this" why not use "this" itself:
instead of "o->parent()->user_data()" where user_data == parent() why
not
"parent()"
-The callback implementation on other parts of fluid assumes that the code
written there will be executed on "root->class" scope.
Again even when your explanation shows a way to make the "sample" work
it's like instead of go straight from point "A" to point "B" we do trip
around for a while before go to "B".
Sorry again but it's a lot confusing, can someone else shed a light here ?
Internal code assuming user_data pointing to a fixed place ?
That kills the utility of having user_data !
And indeed I made the code work by cutting "o->parent()->user_data()" to
"o->parent()" although I didn't use the "text()" instead of "label()", the
point of the sample is to show a possible flaw on the implementation of
Fl_Menu_Bar.
In the sample after make it work when we change a Fl_Menu_Item label from
one instance it affects all instances including the BaseWindow, the point
is to show that the current implementation doesn't allow class
specialization through inheritance.
En 08/11/2010 18:19:04, Greg Ercolano <[email protected]> escribió:
> Greg Ercolano wrote:
>> 2) In the two callbacks, change:
>> option_selected->value(o->label());
>> ..to this:
>> option_selected->value(o->text());
>
> I should add regarding the above: in this context, 'o' is a pointer to
> the Fl_Menu_Bar (not the Fl_Menu_Item).
>
> Since the menubar has no label, label() returns NULL in the above,
> making the value() blank.
>
> Using o->text() returns the title of "the last menu item chosen",
> which is I think what you wanted, eg:
>
> http://fltk.org/doc-1.3/classFl__Menu__.html#65447e98577519c36eb6b3561192e7cd
>
--
Usando el revolucionario cliente de correo de Opera:
http://www.opera.com/mail/
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev