(Note that this was initially (mistakenly) posted to fltk.bugs. Apologies for
the cross-posting and many thanks to Ben for pointing me to the correct forum!)
Hi, folks. I'm using FLTK (fltk-2.0.x-r7704) as part of a C++ application built
in Visual Studio 2005. My Window has a custom object derived from GlWindow
(called RR_GlWindow) and I'm having a problem with setting the cursor via my
overridden "handle()" method. I've tried several variations on the following
with no luck:
int RR_GlWindow::handle(int e) {
printf("Event: %s(%d)\n", fltk_eventnames[e], e);
switch(e) {
case fltk::ENTER:
cursor(fltk::CURSOR_CROSS);
return 1;
case fltk::LEAVE:
cursor(fltk::CURSOR_DEFAULT);
return 1;
default:
return GlWindow::handle(e);
}
}
Essentially, my cursor changes from "default" to "cross" right on the edge of
the GlWindow, but once inside, it becomes "default" again. Based on the results
of the print statement I added, the ENTER event changes the cursor correctly,
but apparently MOVE changes it back to DEFAULT.
If this is helpful, here's my draw() method (directly copied from the "OpenGL
Simple Example" on Erco's very helpful FLTK Cheat Page):
void RR_GlWindow::draw() {
// First time? init viewport, etc.
if (!valid()) {
valid(1);
glLoadIdentity();
glViewport(0,0,w(),h());
glOrtho(-w(),w(),-h(),h(),-1,1);
}
// Clear screen
glClear(GL_COLOR_BUFFER_BIT);
// Draw white 'X'
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_STRIP);
glVertex2f(w(), h());
glVertex2f(-w(),-h());
glEnd();
glBegin(GL_LINE_STRIP);
glVertex2f(w(),-h());
glVertex2f(-w(), h());
glEnd();
}
Anyone have any ideas about why this is happening or suggestions on the best
way to troubleshoot?
Thanks!
don
(ps - Ben: thanks for the help in your response to my post in fltk.bugs!)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk