> >   int handle(int event)
> >   {
> >       switch(event) {
> >           case FL_PUSH: fl_alert("PUSH"); return 1;
> >           case FL_RELEASE: fl_alert("RELEASE"); return 1;
> >       }
> >       return Fl_Button::handle(event);
> >   }
>
>       Watch out in the above code: it's starving PUSH and RELEASE
>       events from Fl_Button's handle() method; the above switch()
>       is returning before the event gets passed to the base class.
>
>       Might be better written as:
>
>          int handle(int event) {
>              int ret = Fl_Button::handle(event)// call this first
>              switch(event) {
>                  case    FL_PUSH: fl_alert("PUSH");
                            ret = 1; break;
>                  case FL_RELEASE: fl_alert("RELEASE");
                            ret = 1; break;
>              }
>              return(r); // all falls thru here
>          }

You seem to be saying that fltk widgets' event handling behavior
has certain requirements that are implemented internally; derived
classes can supplement that behavior but not replace it (or
replace it at their own risk).  If that's the case, it should
really be documented somewhere. Better yet, the required stuff
would be non-virtual.

Cheers,
Stan

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

Reply via email to