Re: Text Field layout



On Mon, 2002-06-17 at 18:36, William L. Thomson Jr. wrote:
I am trying to make a form look pretty. :)

I am coming from a Java background, and in Java I used a gridbaglayout
with various constraints.

With GTK+ I am not sure what to use. I am using GTK+1.2, and using the
vbox and hbox to control layout. I am thinking about experimenting with
the a table?

Or should I just stick with the vbox, and hbox, and do my best with
them?

I have gotten close to what I am looking for, but not exactly.

Any suggestions or recommendations?

I like GTK allot. I just started with C/C++ a week or two ago, and
quickly made progress into gui's.

It was easier to decide what gui library to use, than deciding C or C++.

I'm unfamiliar with Java, though I am reasonably familiar with GTK+'s
layout. Sooo, if you want something like this (warning, ascii art :-)):

Some text:       [__________________]
Some more stuff: [__________________]
Some pulldown:   [ Current Val | ^v ]
[x] Some checkbutton

You'd want to use a GtkTable.

If you want something like this:

[Button1][Button2][Button3][Button4]
[Button5][Button6]

That wraps around based on window width (so, if the user shrinks the
window width, it would look like):

[Button1][Button2][Button3]
[Button4][Button5][Button6]

Then you'd want to use a GtkHWrapBox (GIMP has the source for this
widget, though it is unfortunately not included in GTK+ yet -- so if
you're writing a GPL'd application you can just grab gtkhwrapbox.{c,h}
and it's dependencies [gtkwrapbox.{c,h}]).

GTK+ 2.0 also includes the "GtkSizeGroup", which makes doing stuff like
this a snap:

+-Some GtkFrame-----------------------+
| Some text:     [__________________] |
| Some pulldown: [ Current Val | ^v ] |
+-------------------------------------+

+-Some Other GtkFrame-----------------+
| Stuff:         [__________________] |
| [x] Some checkbutton                |
+-------------------------------------+

Because you can just create a pair of GtkSizeGroups and add all your
labels to one, and your entries to another, (after they're in GtkTables
or GtkVBoxes/GtkHBoxes) and they will always maintain the same (width
&/or height, depending on what you set). Hope that helps.

Also, the HIG has some (somewhat confusing) rules on spacing for GNOME
apps, so they maintain a basically similar look.

http://developer.gnome.org/projects/gup/hig/draft_hig/

Peace,

    Jim Cape
    http://ignore-your.tv/

    "No cause, no God, no abstract idea can justify the mass
     slaughter of innocents."
        -- Edward Said




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