On 10/14/11 10:04, David wrote:
> I would exepect that creating an Fl_Group (then calling beging if needed (not 
> sure if constructor calls) then when adding the round buttons x,y would be 
> relative to the group not the window, but it appears to be based on the 
> window not the group?  Is that correct?

        Yes, all widget and drawing coords are relative
        to the parent window.

        A group is just a grouping widget, it does not affect
        the coordinate space of its children.

        If you want coords relative to the group, replace the
        group with a window instead.. then coordinates will
        be relative to the 'window-in-a-window'.

        The below example shows a window-in-a-window situation:
        win1 is the outer window,
        win2 is the inner window (exists inside win1, like a group)

        A button is created at position 10,10 in each:
        but1 is created inside win1,
        but2 is created inside win2.

        You'll notice even though both buttons are both positioned at 10,10,
        each is relative to its parent window:


#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
int main() {
    Fl_Window win1(400,400,"Win1");                     // create outer window
    win1.begin();
      Fl_Button but1(10,10,140,25,"Button 1");          // create button#1 
inside win1 at 10,10: coords relative to win1
      Fl_Window win2(100,100,200,200,"Win2");           // create inner window 
(window-in-a-window)
      win2.begin();
        Fl_Button but2(10,10,140,25,"Button 2");        // create button#2 
inside win2: coords relative to win2
      win2.end();
      win2.color(FL_RED);                               // make the inner 
window red so we can see it
      //win2.show();                                    // don't need to show() 
a window that's inside another
    win1.end();
    win1.show();
    return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to