Re: Insert Various GTKWidgets into a dlg_window



On Sun, Jun 30, 2013 at 12:34 AM, Rui Pedro Caldeira
<rpcaldeira outlook com> wrote:
Thanks Andrew, that worked perfectly. I'm being able to put all my widgets
into the table. But now I'm having another problem. How can I re-size the
widgets the way I want (standard size)? Because they are taking up all the
space in their own cell in the table [1], I've tried to add more rows, but
the window expands and the buttons stay the same size.

Hi Rui,

With GTK+2 / GtkTable you will need to add padding widgets to take up
extra space,
if you don't want the widgets in the GtkTable to spread out and take
all available space.

This is done with the GtkAttachOptions argument to gtk_table_attach()
when adding
widgets to a GtkTable.

Here are the basic rules which apply to a GtkTable

  o If any children in a row has the GTK_EXPAND option set, then that row
     will receive some extra space when the table is allocated more space
     than it requests.

  o The same rule applies to columns, if a widget in a given column
has GTK_EXPAND
     set, then that column will receive more space than it requested.

  o If no widgets in any row specify GTK_EXPAND, then all rows expand equally

  o And again the same applies to columns, if no columns explicitly expand, they
     all expand.

So if you want all of your widgets to stay in the top / right portion
of the allocation,
then you can add a GtkLabel with no text in the last column and the
last row, and
set only those labels to expand.

Alternatively, you can pack your GtkTable into a GtkVBox or GtkHBox (which
is more typical).

Example:

  GtkVBox {
      GtkMenuBar (expand = FALSE),
      GtkScrolledWindow (expand = TRUE) {
          Some content in the scrolled window
          which would normally eat up all the extra
          vertical space
      },
      GtkTable (expand = FALSE) {
          Some buttons which will never
          receive any extra vertical space
      }
  }

I think you can extrapolate from here, the expand packing
option is what you are after, with this it's possible to create
a variety of dynamic layouts who's base size will depend
mostly on system font sizes, you just decide which elements
receive extra space when your interface receives extra space.

Cheers,
    -Tristan


Thanks in advance,
Rui

[1] Image - http://tinypic.com/r/sxlw0l/5

Cumprimentos,
Rui Pedro Caldeira


On Sat, Jun 29, 2013 at 1:05 AM, Andrew Potter <agpotter gmail com> wrote:

On Fri, Jun 28, 2013 at 2:10 PM, Rui Pedro Caldeira
<rpcaldeira outlook com> wrote:
I'm sorry Andrew but I'm using GTK+ 2.24.19 and there is not GTKGrid on
this
version, aren't you aware of an equivalent for version 2.24.19 of GTK+?

The documentation for Gtk2 can be found here [1]. As you've noticed,
there is no GtkGrid in Gtk2; instead you can use a [2] GtkTable or a
[3] GtkHBox or [4] GtkVBox.

You may also find the Gtk 2 tutorial useful [5].

[1] https://developer.gnome.org/gtk2/2.24/
[2] https://developer.gnome.org/gtk2/2.24/GtkTable.html
[3] https://developer.gnome.org/gtk2/2.24/GtkHBox.html
[4] https://developer.gnome.org/gtk2/2.24/GtkVBox.html
[5] https://developer.gnome.org/gtk-tutorial/stable/book1.html

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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