GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the width (or height) of any widget?

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
ZuLuuuuuu
Familiar Face


Joined: 20 Dec 2007
Posts: 8

PostPosted: Fri Sep 05, 2008 7:32 am    Post subject: How to get the width (or height) of any widget? Reply with quote

Hello,

Is there a way to get the width (or height) of a widget like button or label, in pixels?
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 526
Location: Falun, WI USA

PostPosted: Fri Sep 05, 2008 2:38 pm    Post subject: Reply with quote

It depends on what state your widget is in (shown, realized, mapped etc.), but most of the time you can use widget->allocation,
which is a GtkAllocation struct:
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkAllocation
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP