OK, I have a really simple example (attached) - just a box sitting
inside a window with a margin all around. I override the handle event
to report ENTER and LEAVE events but ... I see no ENTER events (!) and
a LEAVE event whenever the pointer leaves the box *or* the window(!!).
What is going on?
I'm running on Linux 2.6.21.5 . I'm seeing the same behaviour with
1.1.7 and SVN-r5857 .
The context is that I have a box widget that I want to respond to the
keyboard when the mouse is over it, so I want to call focus() on an
ENTER event. But I can't get the event!
TIA,
Jeremy Henty
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
class Box : public Fl_Box {
public:
Box(int x, int y, int w, int h) :
Fl_Box(x,y,w,h) {
box(FL_FLAT_BOX);
color(FL_WHITE);
}
virtual int handle(int);
};
int Box::handle(int) {
switch (Fl::event()) {
case FL_ENTER: printf("ENTER\n");
case FL_LEAVE: printf("LEAVE\n");
}
return 1;
}
int
main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(300,300,"Enter/Leave");
window->begin();
new Box(50,50,200,200);
window->end();
window->show(argc,argv);
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk