Jane wrote: > On 2009-06-30, Albrecht Schlosser <...> wrote: ... >> It's a completely different story, if you uncomment the statement in >> beep_cb: >> "b->value(b->value());". Do you by any chance use value(int) inside your >> callback? > > yeah i do. why is this calling the callback when i drag? > look, the callback is pd->mute(o->value(), 0); > now in mute(); i call value(1) but only if o->value() above was 1 too (and > vice versa, if called with a 0 i call value(0) on it). makes no sense, > yeah, but only if you don't know the rest. :) > > anyway, why does this retrigger the callback when i drag *inside* of the > button, so that mute(0, 0); is being called... then mute(1, 0) again and so > forth....as long as i dra??
That's my secret ;-) No, long story short, this is one of these "I-don't-know-why-this-must-be-so-complicated-and-all-button-types-in-one-handle-method" cases. The "simple" solution is that the button widget stores its state in an "oldval" member variable and triggers the callback when this has changed (as you requested). And this "oldval" variable is set - guess what ? - when value(int) is called (maybe among others). That's why I tested this case and asked you if you used it :-) My suspicion that this code needs some reworking (e.g. to set this oldval only when the mouse button is pushed or something else), but as I wrote before: we need to clarify what the intended behavior is, before we can verify the code, and I don't think that this would happen before release of 1.1.10. Probably this will only be done for FLTK 1.3. Albrecht _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk