On 30.03.2011 18:54, brosnan wrote:
> 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;
Yes, you can, but you must take care that you don't call the
callback twice. That's why I'm not a fan of calling the base
class's handle() unconditionally before doing one's own checks.
See also what Greg wrote about the reasons to call it on FL_RELEASE.
Given the code above, Fl_Browser::handle() would call the
callback on FL_RELEASE, and your code would call it on FL_PUSH
as well.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk