GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 18, 2014 1:07 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: New GTK+ developer trying to keep cell from being resized.
PostPosted: Fri Sep 20, 2013 8:22 pm 
Offline

Joined: Fri Sep 20, 2013 8:06 pm
Posts: 1
I am a horrible GUI developer so I am developing my GUI with the help of glade2. (glade3 xml generation is not working for me and I don't feel like battling it right now). I will try to explain what I am doing:

In a main window, I am placing a 3 column horizontal box, then in the middle row I am placing a 3 column vertical box. So it basically looks like a tic-tac-toe board. I don't want to use a GtkTable. I would like to place all my GUI elements within the center square but when the window is set to fullscreen (set_window_fullscreen), I don't want any of those elements resized.

Any help would be great. Any help in terms of setting values within Glade would be fantastic!

Thanks.


Top
 Profile  
 
 Post subject: Re: New GTK+ developer trying to keep cell from being resize
PostPosted: Wed Sep 25, 2013 12:16 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
You might not want to use GtkTable but it really is for the best if you want something tictactoe shaped.
GTK takes the approach of the minimal amount of force in telling the window manager what to do. A programmer will often take the approach of "I want my app to look like this" and then program exactly how it is meant to look. Many mistakes can be made this way if the programmer isn't aware of how things might be different on different devices (e.g. a close button that does not show within the limits of a netbook screen). GUI design is instead best done in describing the rough layout without trying to foil the window managers attempts to keep the software accessible for all.
Now with the process of having 3 sets of 3 column vbox's. How do these vboxs know to size themselves the same as each other to ensure nice neat horizontal lines across all 3 columns? You could tell them an exact size but that would be forcing. Better is to use the table which has this property inbuilt. Have to learn it at some point anyway as GTK3 has made the transition from boxes and Tables to GtkGrid.
In either way the answer you're after is to play around with the GtkAttachOptions https://developer.gnome.org/gtk3/stable/gtk3-Standard-Enumerations.html#GtkAttachOptions that all tables, boxes, grids have; e.g. ensuring your centre square can shrink in x and y - GTK_SHRINK, the corners can expand freely in x and y, and the sides shrink in one dimension but can expand in the other.


Top
 Profile  
 
 Post subject: Re: New GTK+ developer trying to keep cell from being resize
PostPosted: Wed Sep 25, 2013 10:39 am 
Offline
Familiar Face

Joined: Wed Jan 30, 2013 8:28 pm
Posts: 20
use GtkGrid first and this

"hexpand" property to tell Gtk if the area of the widget should get any available (when expanding the toplevel window) in horizontal direction

"vexpand" like "hexpand" but in the vertical direction

the différents align properties tell to Gtk how the widget has to renderer it in its area! for all GTK_ALIGN_START GTK_ALIGN_END, and GTK_ALIGN_CENTER the size of the widget never change it will be the same; the difference between them are: for START the widget renderer itself on the start of its area, for the END the end and for CENTER, it center itself on the middle ( according to the direction).

you have two align properties:

"halign" for the horizontal direction
"valign" for the vertical direction

to renderer itself a widget use 2 things: its area allocated by its parent and its natural size ( a requested size if gtk_widget_set_size_request or its defaults size define by Gtk itself). Container widget only allocate the (x,y) coordinates and (width,height) dimensions for the area of each child widget. The child widget should use expand properties and align properties to respectively tell Gtk if its area should grow (according to expand properties) and how it want to renderer itself in this area (should I cover all the horizontal direction?? if yes for "halign" set GTK_ALIGN_FILL, should I take my defaults size and renderer myself on the start of the horizontal direction in my area?? if yes set GTK_ALIGN_START)
etc...

One thing to note: if you set FALSE to a particular expanding direction of a container widget (say GtkGrid) all its children will have a default size in this direction. ex: if I set FALSE to "hexpand", all the children of my grid will have a default horizontal size.


Complicated....if you want to properly understand this you should read the code source :p


Top
 Profile  
 
 Post subject: Re: New GTK+ developer trying to keep cell from being resize
PostPosted: Thu Sep 26, 2013 5:23 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 709
Location: UK
nar6du14,
This comment is not very helpful to a beginner as the source to GTK+ is very complex. By going directly to the source code you can be led to use undocumented features which will break in other GTK+ versions. It is always better to read the documentation and tutorials.

Quote:
Complicated....if you want to properly understand this you should read the code source :p

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group