Re: problems with window size


I had this same problem with a dialog I created..

I got it to look OK by just setting in a fixed size request
on the GtkScrolledWindow like such:

gtk_widget_set_size_request(scrolled_window, 300, 200);

Of course this is not the perfect solution, but I find
it a lot better than tiny sized windows which have to be
manually enlarged each time..

hope this helps..

- Daniel

On Sun, 2005-10-30 at 01:52 -0400, Dan McMahill wrote:

I have what is I'm sure is a fairly simple question.

I have a dialog box created with

window = gtk_dialog_new();

Then I create a table containing a bunch of label widgets and stick it 
in the window with

   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
                       table, TRUE, TRUE, 0);

The problem I have is I have is that on some of these dialogs, the table 
is quite long and you end up with a window that is taller than the 
screen.  The dialogs with smaller tables look great though.

So, I changed the code a bit and added scrollbars.  So now I do 
something like:

   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),

   table = gtk_table_new(0,0,FALSE);

   /* create and add a bunch of label widgets to the table */

   /* create and add gridlines */
   [snip - lots more h and v separators added]

    /* put the table in the scrolled window */
           GTK_SCROLLED_WINDOW (scrolled_window), table);

   And finally I stick this scrolled_window into my dialog box in the 
same way that I used to put the table in.

The problem I have now is the dialog boxes always come up very small, a 
tiny fraction of my screen size, and I always have to manually enlarge 
them before they are remotely useful.  The scroll bars a a big help on 
the table which had lots of rows.

So my question is how to tell this dialog box, 'make your self big 
enough to avoid scroll bars unless you would be larger than [display 
size, some fixed size, something...] in which case just use the max 
allowed size'.

I played around with gtk_widget_set_usize, but it makes the smaller 
tables ugly.




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