> > Greg Ercolano wrote:
> > >   But if you want to get mouse click events in an Fl_Browser, you can
> > >   flesh out the above:
> >
> > This will work too; using return(1) in place of "ret = 1; break;"
> > makes the handle() code a bit shorter:
> >
> >     int handle(int e) {
> >         int ret = Fl_Browser::handle(e);
> >         switch (e) {
> >             case FL_FOCUS:
> >             case FL_UNFOCUS:
> >                 return(1);                      // express interest in 
> > keyboard events
> >             case FL_KEYBOARD:
> >                 cout << "keyboard" << endl;
> >                 return(1);
> >             case FL_PUSH:                       // mouse click push
> >                 cout << "push" << endl;
> >                 return(1);
> >             case FL_RELEASE:                    // mouse click release
> >                 cout << "release" << endl;
> >                 return(1);
> >         }
> >         return(ret);
> >     }
> >
>
Thank you.
It is fixed, also is there a way to call the callback if the item is pushed 
instead of when it is released?


int handle(int e) {
        int ret = Fl_Browser::handle(e);
        switch (e) {
            case FL_FOCUS:
            case FL_UNFOCUS:
                return(1);
            case FL_KEYBOARD:
                ret = 1;
                break;
            case FL_PUSH:
                if ( Fl::event_button() == FL_LEFT_MOUSE )
                {
                    return(1); //can you callback here?
                }
                ret = 1;
                break;
            case FL_RELEASE:
                ret = 1;
                break;
        }
        return(ret);
    }



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

Reply via email to