> Hi, test again with returning 0 instead of 1 in your overriden handle()
> method, returning 1 means that you handled the event and it is not cascaded,
> returning 0 should let a chance to main window to catch this event AFAIR.
>
Thank you for your reply.
I have already tried this, but when I do it doesn´t work properly. I need to
do some dragging operation, so I need to safe the state when the mouse is
pushed FL_PUSH. But when I return 0, the FL_DRAG doesn´t work.
here is the sample code:
int BR_GLwindow::handle(int event)
{
switch(event)
{
case FL_MOVE:
mousePoint =
drawingPlan.intersection(camera.unprojectFar(Fl::event_x(),Fl::event_y()),camera.unprojectNear(Fl::event_x(),Fl::event_y()));
this->redraw();
return 0;
case FL_PUSH:
mouseClickX = Fl::event_x();
mouseClickY = Fl::event_y();
if(Fl::event_button()==1)
picking(Fl::event_x(),Fl::event_y());
return 0; //I NEED TO PUT HERE 1, TO HAVE IT WORKED
CORRECTLY
case FL_MOUSEWHEEL:
camera.zoom(exp(Fl::event_dy()*0.08));
this->redraw();
return 0;
case FL_DRAG:
if (Fl::event_button() == 2)
{
camera.move(Fl::event_x(),Fl::event_y(),mouseClickX,mouseClickY);
this->redraw();
mouseClickX=Fl::event_x();
mouseClickY=Fl::event_y();
return 0;
}
if (Fl::event_button() == 3)
{
camera.rotate(Fl::event_x(),Fl::event_y(),mouseClickX,mouseClickY);
this->redraw();
mouseClickX=Fl::event_x();
mouseClickY=Fl::event_y();
return 0;
}
How should look the handle() function in the main Window.Can I do it just like
this?
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(500,500);
BR_GLwindow brglwindow(10,10,480,400,0,&objects);
//MORE STUFF
window->resizable(&brglwindow);
window->end();
window->show(argc, argv);
return Fl::run();
}
int handle(int event)
{
switch(event)
{
case FL_RELEASE:
std::cout<<"ok";
return 1;
}
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk