> i have a window with a child glwindow and i cant make the
> cursor change when its over the glwindow
>
> it changes when im pushing down the mouse button and drag
> wich seems wierd.
Yes - this looks like it may be a fltk-2 bug. Please file an STR for
this.
Do you need to use fltk-2?
If not, then this seems to work OK in fltk-1.1.x and fltk-1.3.x.
The following worked examples show the test I used. The first is the
"fltk-1.x" version and works correctly when built with either fltk-1.1.x
or 1.3.x from SVN.
The later example is "the same" program in fltk-2, but the cursor only
changes to the "hand" shape if the mouse button is held down whilst
entering the GL window.
(Actually, this is not strictly true, the cursor does change, but
immediately changes back...)
----- fltk-1.x example ----------------
// fltk-1.3 version
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/gl.h>
#include <FL/Fl_Gl_Window.H>
Fl_Window *main_win = 0;
class gl_win_test : public Fl_Gl_Window{
public :
gl_win_test(int X,int Y,int W,int H,const char*L=0);
int handle(int ev);
private:
void draw();
};
gl_win_test::gl_win_test(int X,int Y,int W,int H,const char*L) :
Fl_Gl_Window(X,Y,W,H,L){}
void gl_win_test::draw() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_STRIP);
glVertex2f(w(), h());
glVertex2f(-w(),-h());
glEnd();
}
int gl_win_test::handle(int ev) {
int res = Fl_Gl_Window::handle(ev);
if(ev == FL_ENTER) {
cursor(FL_CURSOR_HAND);
res = 1;
}
else if (ev == FL_LEAVE) {
cursor(FL_CURSOR_DEFAULT);
res = 1;
}
return res;
}
int main(int argc, char **argv)
{
main_win = new Fl_Window(700, 500, "GL test");
main_win->begin();
gl_win_test *engine = new gl_win_test (10, 10, 500, 350);
main_win->end();
main_win->show(argc, argv);
return Fl::run();
}
/* end of file */
----- fltk-2 example ----------------
// fltk-2 version
#include <fltk/Window.h>
#include <fltk/Widget.h>
#include <fltk/run.h>
#include <fltk/gl.h>
#include <fltk/GlWindow.h>
#include <fltk/events.h>
#include <fltk/Cursor.h>
fltk::Window *main_win = 0;
class gl_win_test : public fltk::GlWindow{
public :
gl_win_test(int X,int Y,int W,int H,const char*L=0);
int handle(int ev);
private:
void draw();
};
gl_win_test::gl_win_test(int X,int Y,int W,int H,const char*L) :
fltk::GlWindow(X,Y,W,H,L){}
void gl_win_test::draw() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_STRIP);
glVertex2f(w(), h());
glVertex2f(-w(),-h());
glEnd();
}
int gl_win_test::handle(int ev) {
int res = fltk::GlWindow::handle(ev);
if(ev == fltk::ENTER) {
cursor(fltk::CURSOR_HAND);
res = 1;
}
else if (ev == fltk::LEAVE) {
cursor(fltk::CURSOR_DEFAULT);
res = 1;
}
return res;
}
int main(int argc, char **argv)
{
main_win = new fltk::Window(700, 500, "GL test");
main_win->begin();
gl_win_test *engine = new gl_win_test (10, 10, 500, 350);
main_win->end();
main_win->show(argc, argv);
return fltk::run();
}
/* end of file */
----- end of example ----------------
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk