On 29.06.2011 07:23, goodwood wrote:
> Hi Ben, thanks for your help, can you test this code under win7? (my fltk2
> package: fltk-2.0.x-r7513.tar.gz, compiled with mingw under windows)
I compiled and ran your test program with current fltk2 svn (r8842)
on Windows 7. If you want to receive mouse RELEASE (and DRAG) events
you must make sure to return non-zero on the PUSH event (that's what
you were missing).
>
> ====================================================================
> #include<windows.h>
.. ^^^^ not needed here
>
> #include<fltk/run.h>
> #include<fltk/Window.h>
> #include<fltk/Win32.h>
> #include<fltk/events.h>
>
>
> class my_win_class : public fltk::Window
> {
> public:
> my_win_class() : fltk::Window(200, 200, "test")
> {
>
> };
>
> protected:
> int handle(int event);
> //void draw() {return;};
>
> };
>
>
> int my_win_class::handle(int event)
> {
> if (event == fltk::PUSH)
> {
> printf("mouse push: \n");
> //return 1;
uncomment this, i.e. use:
return 1;
or set a variable, maybe
ret = 1; // int ret needs to be declared before
> }
> else if ( event == fltk::RELEASE )
> {
> printf("mouse release: \n");
> //return 1;
> }
> else if ( event == fltk::DRAG)
> {
> printf("mouse drag:\n");
> }
> else if (event == fltk::MOVE)
> {
>
> }
> else
> printf("event=%d\n",event);
>
> return fltk::Window::handle(event);
if you didn't return in your code above, then modify this to
return (fltk::Window::handle(event) | ret);
>
> }
Note that you won't see the output under Windows when it happens,
since stdout is buffered if you run it with MinGW (or Cygwin), so
either use fflush(stdout) where appropriate, or use something like
setvbuf (stdout,NULL,_IONBF,0); // set stdout unbuffered
in your main program.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk