Hi,

I'm confused with the way fl_line works.
In my own widget I redefined the draw method as follow:

 void MyWidget::draw()
 {
   Fl_Group::draw();
   fl_color(FL_BLACK);
   fl_line_style( FL_DOT, 1);

   fl_push_clip(x(), y(), w(), h());

   fl_line(20, 50, 20, 100);

   fl_pop_clip();
  }

In that case the line drawn is 50px and not 100px, so I guess that
the line actually starts at the top of the widget
so the proper way to get a 100px line should be:

fl_line(20, 50, 20, 50 + 100);

More strange is the behaviour of fl_line if the parent widget
(the main window in my case) resize my widget ex:

resize(x(), 50, w(), h())

Now the line drawn is back to 50px.
It would means that line doesn't start at the top of my widget but
at the top of the parent widget (the main window) and
the correct code would be:

fl_line(20, y() + 50, 20, y() + 50 + 100);

Why doesn't the line  start at the top of the widget in wich it drawn ?
And why such a tricky way to drawing lines ?


Thanks for advance
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to