in reply to gtk2 widgets positions

I know this isn't what you're asking, but my advice is to avoid fixed pixel offsets. I learned that lesson with Motif and I live by it today.

The problem is if you switch to a different sized monitor, different resolution, or any of a bunch of user configuration items, what was a carefully crafted layout becomes an ugly jumble. Put minimum sizes for things that are fixed (say an image), but let everything else flow with the shape of the controlling window. You never can tell what the user, and his window manager, are going to do.

Of course, if this is just for your personal use, do what you want. Toy projects usually have friendly users, so there is less of a problem.

- doug

Replies are listed 'Best First'.
Re^2: gtk2 widgets positions
by zentara (Cardinal) on Dec 15, 2009 at 16:25 UTC
    avoid fixed pixel offsets

    .... yeah.... i think what happens is people learn fixed positioning in things like Tk place() or grid(),(or your Motif) and expect it to be there in more advanced toolkits.....like you said....it's really bad for resizing

    ...fwiw, you can control the exact position of a widget in a Gtk2 container, but you need to delve into the low-level Gdk window.... and then there are all sorts of refresh problems.... but see Gtk2 low-level icon for how it's basically done..... you could use an expose callback of sorts to get around refresh.....

    ....but generally the idea is to use the container packing they provide..... it's just a different way of looking at things..... but it works quite well..... after you construct 10 or 20 apps you get the hang of it :-)

    ..... in a fancy design where you want aligned buttons and widgets, the Gtk2::Table is the way to go.....just fill in empty table corners with wallpaper....i.e. empty labels or tiled images


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku