Many thanks, I just rewrite the program, but the same problem still appear... 
alas..(raise the window after minimizing, there is nothing..)
[Main function]
  Fl_Double_Window top_window(GLOBAL_WIDTH, GLOBAL_HEIGHT);
    Fl_Button *list_bt = new Fl_Button(10, 10, 100, 20, "Print Points");
    Fl_Button *hull_bt = new Fl_Button(120, 10, 100, 20, "Convex Hull");
    Fl_Window draw_window(0, 40, WINDOW_WIDTH,WINDOW_HEIGHT);
      MyDraw *draw = new MyDraw(0, 40, WINDOW_WIDTH,WINDOW_HEIGHT);
      list_bt->callback(list_callback, draw);
      hull_bt->callback(hull_callback, draw);
    draw_window.end();
  top_window.end();
  top_window.show(argc, argv);
  return Fl::run();
[MyDraw Class is derived from Fl_Box]
int MyDraw::handle(int e)
{
        int ret = Fl_Box::handle(e);
        switch (e)
        {
        case (FL_PUSH):
            point = new MyPoint(Fl::event_x(), Fl::event_y());
            redraw();
            break; //exit switch case
         .....
}
void Mydraw::draw() {
      fl_circle(....)
     .....
}
>
> >   Hi, I am writing a small problem to implement an algorithm=20
> > in graphics.
> > And I inherit Fl_Window to catch mouse click to draw some=20
> > circle and lines on it. It works fine, but after I minimizing=20
> > my window, those lines never appear, the draw() function I=20
> > override is called (since I put some printf inside for=20
> > debugging; it only appear after I use mouse to click on the window.
>
>
>
>
> > int MyWindow::handle(int e)
> > {
> >     int ret =3D Fl_Window::handle(e);
> >     switch (e)
> >     {
> >     case (FL_PUSH):
> >             point =3D 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=20
> > bring up from minimized in the toolbar, and it DOES call=20
> > MyWindow::draw, but it just don't show up immediately, it=20
> > shows only after the next FL_PUSH happens !
> >     }//end switch case
> >     return ret;
>
>
> OK, there are a few things to think about;
>
> - Firstly, as outlined in the docs, NEVER call the draw method directly.
> Call redraw(), and allow the fltk rendering loop to manage the redraw
> and expose events for you.
> Also, a redraw will be scheduled after an expose event anyway, so what
> you are doing in your handle method is unnecessary, it will be done
> anyway.
>
> - Secondly, Fl_Window is a container widget, not really a surface on
> which you should draw directly. You would probably be better off
> deriving your drawing surface from a simple widget like Fl_Box and
> drawing on that, enclosing your box-derived widget in an Fl_Window
> container.
>
> This is all covered in the docs, and the worked examples in the "test"
> directory show how to do this, so you should start by copying one of
> those and extending it to your needs, to explore how this all works.
>
>
>
>
>
>
>
> 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

Reply via email to