On Wed, Jul 04, 2007 at 12:32:16AM +0100, Jeremy Henty wrote:
> On Tue, Jul 03, 2007 at 08:45:10PM +0200, matthiasm wrote:
> 
> > Please put a "break;" statement at the end of the "case" line.
> > 
> > ... your last line should be
> > 
> >    return Box::handle(event);
> 
> Thanks for this, but sadly it makes no difference.  I'm still seeing
> no ENTER events and a LEAVE event whenever the pointer leaves the box
> *or* the window.

OK, here's some progress.  The value returned by Fl::event() is *not*
the same as the value passed to handle() (!!!).  If I test the
argument of handle() instead of Fl::event() then I see ENTER events.
I still see spurious LEAVE events when the pointer leaves the window
(rather than the box), so that's still, *ahem*, "challenging", but I
can deal with that.  It would still be nice to know what's going on
here.

(Latest version attached.)

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 ev) {
  // switch (Fl::event()) {
  switch (ev) {
  case FL_ENTER:
    printf("ENTER; ev = %d ; Fl::event() = %d ;\n",
           ev,Fl::event());
    break;
  case FL_LEAVE: printf("LEAVE\n"); break;
  }
  return Fl_Box::handle(ev);
}

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

Reply via email to