> 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.
>


Works great, thank you. I came up with a slightly improved version:

int
Slider::handle(int ev)
{
    // do the base-class actions
    int res = Fl_Slider::handle(ev);

    // now check for wheel-mouse events & if we are below the pointer
    if (ev == FL_MOUSEWHEEL && this == Fl::belowmouse())
    {
        // for wheel - use dy
        int dy = Fl::event_dy();
        double v1 = value(); // current value
        if (v1 == clamp(increment(v1, dy))) // save midi bandwidth :)
            return 1;
        v1 = increment(v1, dy); // change
        value(v1); // update widget
        do_callback(); // trigger callback
        return 1; // say we ate this event
    }
    return res;
} // handle


(I also backported FLTK 1.1.9 to Debian/etch, anyone interested?) *Happy* :)

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

Reply via email to