Re: How to get the widget's current width and height?
- From: John K Luebs <jkluebs luebsphoto com>
- To: Tom Liu <tom liu flextrade com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How to get the widget's current width and height?
- Date: Tue, 18 Nov 2003 23:52:16 -0500
On Tue, Nov 18, 2003 at 09:29:50AM -0500, Tom Liu wrote:
gdk_drawable_get_size(w->window,&wid,&hi); may work for the widget which
has a xwindow such as eventbox. For vbox, label, button etc. It will not
work.
Can't believe there is no function to retrive size of widget?!
There is a good reason for this. The size of a widget (it's allocation)
is dynamic (can be changed by the user, WM, etc.), so having a function
to query the current size would just facilitate writing fundamentally
broken code. There's no point in getting a value that could become
invalid the moment you return to the mainloop.
As another poster has told you, you should connect to size-allocate.
This way you know that you always have the correct size, and can react
appropriately.
You should also take a moment to think about why you need the size.
Are you sure this is not something you can do in a more
straightforward manner using the packing mechanisms?
--jkl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]