Hmm, why don't you just use the pointer to the Fl_Menu_Item you want to 
change and call the do_callback method?

http://www.fltk.org/doc-1.3/structFl__Menu__Item.html

Of course you will need to get the pointer first:

Use: Fl_Menu_Item* pItem= mymenu->find_item("path/to/menuitem");
or  Fl_Menu_Item* pItem= mymenu->find_item(callback_of_menuitem);

More methods here: http://www.fltk.org/doc-1.3/classFl__Menu__.html

I hope this takes care of your problem.

Cheers, Herman



On 10/15/2012 01:00 PM, vigmond.ucalgary wrote:
> I can create the callback from fluid without problem. The issue I have is 
> that I want to trigger the callback from outside of the GUI. In my case, I am 
> reading in a state file which changes menu settings. When I examine the fluid 
> generated code, it calls the callback I defined indirectly.
>
> For example, I have a Fl_Menu_Item called "revdraworder" whose callback I 
> want to trigger from some part of my program. Here is the fluid code 
> generated for the callback:
>
> void Controls::cb_revdraworder_i(Fl_Menu_* o, void*) {
>    // I defined this callback in fluid
>    my_function( (bool)(o->mvalue()->value()) );
> }
>
> void Controls::cb_revdraworder(Fl_Menu_* o, void* v) {
>    // fluid generated this
>    ((Controls*)(o->parent()->user_data()))->cb_revdraworder_i(o,v);
> }
>
> I need to pass a Fl_menu_ pointer to cb_revdraworder() but cannot figure out 
> which one. Somewhere in my code I will write
>
> revdraworder->do_callback(w)
>
> which will call cb_revorder() which will call cb_revorder_i().
> How do I know what the value of w is?
>
> I hope this clarifies things
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to