Re: GtkAlignment makes things smaller, but surrouning don't get bigger



On Mon, Mar 07, 2005 at 04:55:55PM -0500, Owen Taylor wrote:
...
> Setting the expand property on the buttons will have no affect on
> how the GtkVBox allocates space. You'd have to set the property on
> the immediate child of the GtkVBox.
> 
> (Note that 'expand' is actually a "child property". The set of 
> "child properties" on a widget depends on what container it is packed
> into, not what the type of the widget is.)

Thank for your help Owen.  I feel like I understand, but what I'm trying
still doesn't work.  Here's a little more information.

this is more or less what I'm doing...

  mydialog = gtk_dialog_new ();
  gtk_window_set_title        (GTK_WINDOW (mydialog), "Payment Amount");
  gtk_window_set_position     (GTK_WINDOW (mydialog), GTK_WIN_POS_CENTER);
  gtk_window_set_modal        (GTK_WINDOW (mydialog), TRUE);
  gtk_window_set_default_size (GTK_WINDOW (mydialog), 320, 350);
  gtk_window_set_type_hint    (GTK_WINDOW (mydialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  vbox8 = GTK_DIALOG (mydialog)->vbox;
  gtk_widget_show (vbox8);

  mycalculator = createcustwidgetfunc_enterpaymentdlg_handleamount ("mycalculator", "", "", 0, 0);
  gtk_widget_show (mycalculator);
  gtk_box_pack_start (GTK_BOX (vbox8), mycalculator, TRUE, TRUE, 0);
  GTK_WIDGET_UNSET_FLAGS (mycalculator, GTK_CAN_FOCUS);
  GTK_WIDGET_UNSET_FLAGS (mycalculator, GTK_CAN_DEFAULT);

  alignment14 = gtk_alignment_new (0.5, 0.5, 1, 0.5);
  gtk_widget_show (alignment14);
  gtk_box_pack_start (GTK_BOX (vbox8), alignment14, TRUE, TRUE, 0);

  hbox11 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox11);
  gtk_container_add (GTK_CONTAINER (alignment14), hbox11);

After that I add some buttons to hbox11 setting the fill and expand
properties to TRUE (which doesn't affect the layout).  So... all expand
and fill props (that I know of) are set to TRUE and the alignment has
default values except the yscale is set to .5.

The result of this is hbox11 takes up less space and mycalculator
doesn't take up any additional space, leaving some empty space around
hbox11.

if I change the alignment so that it doesn't get any smaller,

  alignment14 = gtk_alignment_new (0.5, 0.5, 1, 1);

...then the hbox11 is too big.

If I instead change either the expand or fill props on alignment14 to
false then I wind up with hbox11 being too small, regardless of what the
yscale is set to.  setting expand to false results in the calculator
widget taking up the available space.  leaving expand set to true and
setting fill to false results in too small box11 buttons with a lot of
wasted goofy looking space.

I think I've exhausted by options with this configuration and I'm
wondering if over configurations will work better.  for instance, one
thing I'm planning is to try leaving the dialog's built in vbox alone
and instead adding a vbox to the one available space.  maybe there's
something goofy about the dialog's built in vbox?

- Ben




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