On 06/10/11 10:16, Li Ding wrote:
>> On 06/09/11 01:41, Li Ding wrote:
>>> I took a day to figure this out (not a bug but a feature).
>>
>> Would like to know what examples/tutorials/docs
>> you were using for reference.
>>
>> They should all show the need to use x(),y(),w(),h()..
> I read the fltk 1.3 manual. But this problem seems not to be explicitly
> mentioned.
Yes, the coordinate space should be mentioned in the docs if it's not.
I imagine it should at least be mentioned here:
http://fltk.org/doc-1.3/drawing.html
..perhaps even a small subsection unto itself about 'Coordinate Space
of Widgets'
with a paragraph or two, and an image showing a window with widgets in
it,
and the coordinates of the upper-left corner of each window.
> However, most write-your-own-widget examples put the widget in (0,0)
> of the top window,
Right: these are the docs I wanted to know about.
If you can recall the examples that confused you, that'd help
us make sure the examples are fixed.
There really shouldn't be any examples deriving from an
Fl_Widget that shows draw() code referencing 0,0, as that
would be wrong for sure.
However, deriving from an Fl_Window it would make sense,
as in that case all drawing should be done relative to 0,0,
as the window's draw() coordinate space would be relative to itself,
and x() and y() in a window represent the window's position
on the parent (ie. its position on the desktop, relative to the root
window)
Perhaps you were looking at examples derived from Fl_Window
instead of Fl_Widget or Fl_Group, where the coordinate space
would be 0,0.
This distinction of widgets vs. windows should certainly be
pointed out in the "drawing" section of the docs, and this
section referenced from other parts of the docs where we talk
about deriving custom widgets.
If I can, I'll see if I can add that.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk