You have forgotten to add the offset to the position perhaps?
Your third line is correct.
See below.
> #include <FL/Fl.H>
> #include <FL/Fl_Window.H>
> #include <FL/Fl_Widget.H>
> #include <FL/fl_draw.H>
>
> class wid : public Fl_Widget {
> public:
> wid(int x, int y, int w, int h, const char *l=0):Fl_Widget(x,y,w,h,l){ }
> virtual void draw(){
> static int X = x();
> static int Y = y();
> static int W = w();
> static int H = h();
>
> fl_push_clip(x(),y(),w(),h());
> // first line
> fl_color(FL_BLACK);
> for(int _x = X; _x < W; _x++){ fl_point(_x, Y); }
for(int _x = X; _x <= X+W; _x++){ fl_point(_x, Y); }
> // second line
> fl_xyline(X, Y+5, W);
fl_xyline(X, Y+5, X+W);
> // third line
> fl_line(X,Y+10, X+W, Y+10);
> fl_pop_clip();
> }
> virtual int handle(int e){
> return Fl_Widget::handle(e);
> }
> };
>
>
> // fltk-config --compile wid.cxx
> int main(){
>
> Fl_Window win(0,0,200,150,"Main Window");
> win.color(FL_WHITE);
> wid* my = new wid(10,10, 180, 130);
> win.end();
> win.show();
>
> return Fl::run();
>
> }
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk