Hi, I am writing a small problem to implement an algorithm in graphics.
And I inherit Fl_Window to catch mouse click to draw some circle and lines on
it. It works fine, but after I minimizing my window, those lines never appear,
the draw() function I override is called (since I put some printf inside for
debugging; it only appear after I use mouse to click on the window.
[Code is as the following (some are omitting)]
class MyPoint{
public:
int x, y;
}
class MyWindow:public Fl_Window
{
MyPoint point;
public:
MyWindow(int x, int y, int w, int h):Fl_Window(x,y, w, h) {}
int handle(int e);
void draw();
};
int MyWindow::handle(int e)
{
int ret = Fl_Window::handle(e);
switch (e)
{
case (FL_PUSH):
point = new MyPoint(Fl::event_x(), Fl::event_y());
draw();
break; //exit switch case
case (FL_SHOW):
printf("FL_VISIBLE\n");
draw(); /** <-- want to draw after the window is bring up from
minimized in the toolbar, and it DOES call MyWindow::draw, but it just don't
show up immediately, it shows only after the next FL_PUSH happens !
}//end switch case
return ret;
}
void MyWindow::draw()
{
Fl_Window::draw();
fl_circle(point->x, point->y, POINT_SIZE);
/*** actually I am drawing a list of nodes by using fl_circle here,
but just omit them for clarity ***/
}
Many thanks
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk