> Very nice, thank you. One question (that I had anyway): if 
> you call value(v) on an object the callbacks are disabled, 
> right? (Or probably i should say "callbacks are only 
> triggered when...(???) so value(v) does not trigger it").
> 
> I am asking because this is different from how GTK works. In 
> GTK the callback is being called on every widget change even 
> on "forced changes" eg on 
> gtk_toggle_button_set_active(*button, TRUE);.
> 
> I like the FLTK-way better because I almost always had to 
> disable callbacks in GTK if I set the widgets to a new value.
> 
> However, sometimes it is desired to trigger the callback on 
> value(v) changes, like in this MouseWheel demo: changing the 
> slider with the wheel has currently no effect.
> 
> In this case we would just tell FLTK to trigger the callback: 
> ... (your turn) :)

You can use the when() method of the widget to configure what conditions
execute the callback - you need to check the docs, as it varies a bit
from widget to widget, but for example Fl_Button says:

"
0: The callback is not done, instead changed() is turned on. 

FL_WHEN_RELEASE: The callback is done after the user successfully clicks
the button, or when a shortcut is typed. 

FL_WHEN_CHANGED : The callback is done each time the value() changes
(when the user pushes and releases the button, and as the mouse is
dragged around in and out of the button). 
"


And there are a few other cases in other widget types, IIRC.

If you *want* to explicitly trigger a widget's callback
programmatically, then you just do:

        widget->do_callback(...);

Passing appropriate parameters, and the widget will execute its callback
as if it were clicked on.




SELEX Sensors and Airborne Systems Limited
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

Reply via email to