[gtk-list] Resizing drawing area immediately



Conrad Steenberg <conrad@srl.caltech.edu> wrote:

>I have a drawing area widget inside a scrolled window widget. If The main
>window (or widget) containing the scrolled window is resized, the drawing
>area widget also gets resized.
>
>Does anyone know how to prevent this resizing, or more accurately,
>override the size parameters widget->allocation.[width,height]? 
>
>I currently have a signal handler connected to the configure event of the
>drawing area where the size of widget is changed by gtk_drawing_area_size.
>But this does not work immediately, only after the widget is redrawn. 

It sounds like you do not want the drawing area to expand when it's size
becomes smaller than the scrolled window's size. If so, put the drawing_area
into a table and put that into the scrolled window. Here's how I do it:

        /* scrolled window */
        viewwindow = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewwindow),
                                        GTK_POLICY_AUTOMATIC,
                                        GTK_POLICY_AUTOMATIC);
        gtk_widget_show (viewwindow);

        /* table for resize */
        viewtable= gtk_table_new (1,1,TRUE);
        gtk_container_add(GTK_CONTAINER (viewwindow),viewtable);
        gtk_widget_show (viewtable);

        /* imagewindow */
        imagewindow = gtk_drawing_area_new();
        gtk_table_attach(GTK_TABLE (viewtable),imagewindow,0,1,0,1,GTK_EXPAND,
                                        GTK_EXPAND,0,0);
        gtk_widget_show (imagewindow);

Hope this helps,
John
--
John Ellis <johne@bellatlantic.net>
http://www.geocities.com/SiliconValley/Haven/5235/



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