Re: [fltk.general] can't get no FL_DRAG event

2013-04-13 Thread testalucida

thank you.



>
On 04/13/13 14:47, testalucida wrote:
> > can someone explain, what's wrong with this code? There's no FL_DRAG event 
> > upcoming in the Box class:
>
>   The docs for the FL_DRAG event will tell you why:
>   http://fltk.org/doc-1.3/events.html
>
>   Under the section "Mouse Events":
>
> 
> FL_DRAG
> [..]
> In order to receive FL_DRAG events, the widget must return non-zero
> when handling FL_PUSH.
> 
>
>   So add this one line to your handle() method:
>
>   if (evt == FL_PUSH) rc = 1;
>
>   Or, just rewrite the handle() method with a switch(), ie:
>
> int handle(int evt) {
> int rc = Fl_Box::handle(evt);
> switch (evt) {
> case FL_PUSH: rc=1; break
> case FL_DRAG: printf("Dragging..\n"); rc=1; break;
> }
> return rc;
> }

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] can't get no FL_DRAG event

2013-04-13 Thread Greg Ercolano
On 04/13/13 14:47, testalucida wrote:
> can someone explain, what's wrong with this code? There's no FL_DRAG event 
> upcoming in the Box class:

The docs for the FL_DRAG event will tell you why:
http://fltk.org/doc-1.3/events.html

Under the section "Mouse Events":


FL_DRAG
[..]
In order to receive FL_DRAG events, the widget must return non-zero
when handling FL_PUSH.


So add this one line to your handle() method:

if (evt == FL_PUSH) rc = 1;

Or, just rewrite the handle() method with a switch(), ie:

int handle(int evt) {
int rc = Fl_Box::handle(evt);
switch (evt) {
case FL_PUSH: rc=1; break
case FL_DRAG: printf("Dragging..\n"); rc=1; break;
}
return rc;
}
___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk