Positioning widgets freely inside a window



Sorry the basic question, but I didn't find reference in the FAQ nor
the documentation.

Is it possible to position widgets relatively to the parent widget? I
am trying to do the following:


int main (int argc, char *argv[]) 
{

    GtkWidget *window;
    GtkWidget *button1;
    GtkWidget *button2;


    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* sets the border width of the window. */
    gtk_container_border_width (GTK_CONTAINER (window), 10);
    gtk_widget_realize(window);

          /* create a new buttons */
    button1 = gtk_button_new_with_label ("Button1");
    button2 = gtk_button_new_with_label ("Button2");


    gtk_container_add (GTK_CONTAINER (window), button1); 
    gtk_container_add (GTK_CONTAINER (window), button2);


    gtk_widget_set_uposition (button1, 10, 10);
    gtk_widget_set_uposition (button2, 10, 100);
    gtk_widget_show(button1);
    gtk_widget_show(button2);
    gtk_widget_show (window);

    gtk_main ();
    
    return 0;
}


But only button1 is shown. I guess I would need a different widget as
a container for buttons (like Motif bulletin board). How do I do that?


-- 
Sami Kallio	                    		email: samik@eiffel.com
Interactive Software Engineering, Inc.		Tel: +1 805 685-1006
270 Storke Rd, 2nd fl, Goleta, CA 93117, USA   	Fax: +1 805 685-6869
Customer support: support@eiffel.com           	http://www.eiffel.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]