views:

312

answers:

1

I am absolutely terrible at GUIs - can you SO gurus point me to good tutorial material on layout management tips & tricks with Glade for GTK+ ?

(The first google hits on "glade tutorials" do not count)

+1  A: 

Look into layout containers.

In GTK+, layout is almost never hard coded. Unlike in the Windows API, in which you get the fixed size and location you ask for, GTK+ takes a different route. You ask for a size, but you aren't actually guaranteed to get it. This helps programs scale to different sized monitors and viewports.

Because you don't have a fixed window size, you can't have fixed window layouts. The widgets inside have to be fluid in their arrangement. This is where GTK+ containers come into play. Containers, basically, are widgets that contain other widgets. The special thing about them, though, is that they give you much flexibility in how the widgets are placed. You can use GtkVBox to stack items, GtkTable to give each element space like the HTML <table> element does, or even GtkFixed to use a Fixed coordinate system as you would in Windows.

Think of the GIMP toolbox as an example: you can stretch the window to different sizes, but the icons reorder themselves to the new shape and size of the window.

Containers are explained in-depth and from a coding perspective here.

Glade makes it rather simple to add widget layout containers. At the bottom of the widget toolbox, you will see several icons that look like groups of small buttons. For example, GtkVBox looks like three wide buttons on top of each other. Add one of these to your window, and add the widgets you want it to contain as children.

Patrick Niedzielski
+1: thanks for all the great input... beats from having to google tons of pages.
jldupont