On 16/03/11 23:02, Julia Jacobson wrote:
>> class MyStringList : public StringList {
>>       public:
>>       int children(const Menu* menu) {
>>           return ((Menu*)(menu->user_data()))->number_of_items();
>>       }
>>       const char * label(const Menu* menu, int index) {
>>           return ((Menu*)(menu->user_data()))->label(index);
>>       }
>> };
> In http://www.fltk.org/doc-2.0/html/classfltk_1_1StringList.html I had 
> already seen the hint to create a subclass, but I was able to figure out what 
> is meant for what 'MyClass*' stands (sure, a pointer on a class, but with 
> which properties).
> When I try to use your code snippet, I get one error saying that 
> 'number_of_items' is no element of the class fltk::menu (line 4) and another 
> one lamenting an impossible conversion from 'int' to 'const char *' in 'void 
> fltk::Widget::label(const char *)' (line 7).
> _______________________________________________
> fltk mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk
>
>
MyClass is supposed to be a reference to a derived class from fltk::Menu.
Uh, also, you might need to change number_of_items() to "children()" and 
change the label(index) line to read:
return ((Menu*)(menu->user_data()))->child(index)->label();
I copied that class from the docs - seems like they're going to have to 
be majorly reviewed....
Regards,
Ben

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

Reply via email to