Hi,
I have created my own class:
class tag: public Fl_Widget {
private:
char text[80];
Fl_Color tcolor;
int tfont;
int tfontsize;
int posx;
int posy;
void draw(){
printf("tag draw of %s\n",text); // trace
fl_color(tcolor);
fl_font(tfont,tfontsize);
fl_draw(text,posx,posy+(tfontsize/2));
}
public:
tag(char *tobeshown, int x, int y, int w, int h): Fl_Widget(x,y,w,h) {
strcpy_s(text,tobeshown);
posx=x;
posy=y;
// Default font, font size, color
tcolor=FL_BLACK;
tfont=FL_HELVETICA;
if (h<18) tfontsize=h;
else tfontsize=18;
}
void color(Fl_Color textcolor) {
tcolor=textcolor;
}
void font(int font, int size) {
tfont=font;
tfontsize=size;
}
};
However when I instantiate the class inside a window nothing is shown:
Fl_Window *win_v;
win_v = new Fl_Window(400, 300);
win_v->modal();
win_v->label("Verify");
win_v->begin();
tag l1("Verify",0,0,80,50);
l1.font(FL_HELVETICA_BOLD,50);
win_v->end();
win_v->show();
win_v is a second window and created by pressing a button on the first window.
I could post the entire code but it is a bit long.
The trace shows that the "draw" method of tag is not being called.
Can someone please tell me how I can fix this?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk