GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Apr 19, 2014 1:52 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: label left aligned, entry right aligned
PostPosted: Thu Dec 13, 2012 10:46 am 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 35
Hello! I have a new problem:
I have many dialogs to enter some parameters.
I show them in a table with 2 columns: in the first column the label of the parameter should be left aligned
In the second column, the value of a parameter (can be a spin, an entry or a checkbox) should be right aligned.
I tried with gtk_misc_set_alignment and with set_justify and with gtk_alignment_new
it doesn't work. Look at my attached picture please, all lables and all entrys are centered

Code:
gtk_table_attach(GTK_TABLE (tableParam),label,col,col+1,row,row+1,GTK_EXPAND,GTK_EXPAND,1,1);
gtk_table_attach(GTK_TABLE (tableParam),spinOrEntry,col+1,col+2,row,row+1,GTK_EXPAND,GTK_EXPAND,1,1);


How should I make it in a table? in a vbox?
Thanks a lot in advance
MBoerner


Attachments:
alignment.jpg
alignment.jpg [ 20.23 KiB | Viewed 494 times ]
Top
 Profile  
 
 Post subject: Re: label left aligned, entry right aligned
PostPosted: Sun Dec 16, 2012 11:41 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Just add GTK_FILL and watch the magic happen.
unless you have allocated free space to shuffle things around in justifying something doesn't make any difference (e.g. 2.3 cm of text in a 2.3 cm centre justified space looks the same whether the text is left or right justified within it).

btw Using hbox and vbox combinations can work but there's no guarantee you'll get nice clean alignment of both the rows and columns (e.g. hboxes in a vbox can give jagged column lines due to the lack of consistency across rows).

p.s. It would have been nice to have code for the examples of other things you had tried but luckily the bit you did put was perfect for the job.


Top
 Profile  
 
 Post subject: Re: label left aligned, entry right aligned
PostPosted: Mon Dec 17, 2012 7:30 am 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 35
Thanks a lot, Paul Childs, I saw the magic happen!
It works perfect,
Have a good week
MBoerner


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] 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