Hi,
I'm a bit confused about how to use a child widget's coordinates.
In the following code, a parent group owns a Fl_Box child widget:
int main() {
// Main window
Fl_Double_Window window(400, 300, "FLTK Coordinate Test");
// Parent group at a specific position
Fl_Group* parentGroup = new Fl_Group(50, 50, 300, 200);
parentGroup->box(FL_DOWN_BOX);
parentGroup->color(FL_GRAY);
// Simple Fl_Box owned by parentGroup
0, 0, 100, 100, "Fl_Box");
Hi,
I'm a bit confused about how to use a child widget's coordinates.
[..]
Pretty much what everyone said so far; all xy coodinates of child widgets are relative to the parent window.
There is one caveat; if you really want 0,0 to be the upper left corner of a child group, replace Fl_Group with Fl_Window, so basically you have a "window in a window" - fltk calls this a 'subwindow'. Then the upper/left corner of that becomes the origin for the entire child hierarchy below it.
But usually when you construct widget hierarchies, you do your x,y math relative to the parent "top-level" window, and avoid windows-in-windows unless really necessary.