Re: problems with window size
- From: Dan McMahill <mcmahill mtl mit edu>
- To: Daniel Pekelharing <legendstar gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: problems with window size
- Date: Sun, 30 Oct 2005 12:25:31 -0500
Daniel Pekelharing wrote:
Hi,
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..
I played around with this a bit, but unfortunately I'm not able to find
a single size which is good. Part of my problem is I have about 4-5 of
these windows and the code is generated based on a ascii file which
contains the data to go in the tables. Each table has a different # of
columns and rows so the "best" size varies. Also I'm sure with
different fonts or themes, the best size will vary.
Thanks for the tip though. I wasn't actually sure at first which widget
should get the gtk_widget_set_size_request().
-Dan
On Sun, 2005-10-30 at 01:52 -0400, Dan McMahill wrote:
Hi,
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),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
table = gtk_table_new(0,0,FALSE);
/* create and add a bunch of label widgets to the table */
[snip]
/* create and add gridlines */
item=gtk_hseparator_new();
gtk_table_attach(GTK_TABLE(table),item,0,7,0,1,
GTK_FILL, GTK_FILL,1,1);
[snip - lots more h and v separators added]
/* put the table in the scrolled window */
gtk_scrolled_window_add_with_viewport(
GTK_SCROLLED_WINDOW (scrolled_window), table);
gtk_widget_show_all(scrolled_window);
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.
Suggestions?
Thanks!
-Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]