If I don't use "handle()" in my programm, just delet the code/function mark 1,2
down there. My programm work well, draw a sub window with a colored border in
root window. But, when I use "handle()", the EcgWin::draw() doesn't work? The
programm will not run EcgWin::draw() at all.
Why???
Please help me, Thanks!!!
Following is my simple code.
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
/**********************************************************************
**********************************************************************/
class EcgWin: public Fl_Window {
int handle(int); <================================================== 1
void draw();
public:
EcgWin(int x,int y,int w,int h,const char *l=0)
: Fl_Window(x,y,w,h,l) {}
}*ecg_win;
/**********************************************************************
**********************************************************************/
int EcgWin::handle(int e) { <=================================================
2
return 1;
}
/**********************************************************************
**********************************************************************/
void EcgWin::draw() {
printf("EcgWin::draw()\n");
Fl_Window::draw();
fl_color(FL_RED); // set border color
fl_rect(0, 0, w(), h()); // draw the border
}
/**********************************************************************
**********************************************************************/
void do_redraw(Fl_Widget*, void*) {
ecg_win->redraw();
}
/**********************************************************************
* main()
**********************************************************************/
int main(int argc, char **argv) {
Fl_Window *root_window = new Fl_Window(800, 600, "FmGUI");
ecg_win = new EcgWin(10, 10, 190, 190);
ecg_win->end();
root_window->resizable(ecg_win);
root_window->end();
root_window->show(argc, argv);
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk