> 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.
Right; Have you read Greg's "Cheat Pages"? I'm pretty sure he covers this sort of usage... Try, um... http://www.seriss.com/people/erco/fltk/#Menu_Toggle and the subsequent related examples, see if that helps at all. > 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? Note that the whole "cb_thing()" calling "cb_thing_i()" dance is just a convenience to allow fluid to use a static member function for the callback. The callback function needs to be static, or perhaps even "plain C", to allow the compiler to resolve it at compile time - indirection via the static member function to the "actual" widget callback method is then done... But, if you are creating your own menu structure, or are adding/removing menu items dynamically, you don't have to go that way - you can just have the callback be a regular (non-member) function that is called by the menu item, or which you can just call yourself. Which may be simpler in your case? So, um, anyway, if Greg's examples don't help... Well, just keep asking! Cheers, SELEX Galileo Ltd Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

