Sizing top level windows and gtk_widget_size_request problems


I'm hoping someone may be able to offer me some advise here. I guess I don't fully understand the way that gtk sizes widgets and, in particular, top level windows. When I set the size of a window with gtk_widget_set_usize (width, height) the widget usually resizes to the size I have specified. However, if I call this on a top level window widget and the size is smaller than its current size nothing happens and the window remains its current size. I have also seen the same thing when a widget is inside a gtk_scrolled_window and I resize it. It never gets smaller. Am I using the wrong function for this?

I have also noticed that if I create a button, say, with a label inside it and then I change the text of the label and then ask the button what size it wants to be (with gtk_widget_size_request) it returns the same size as before the label was changed. Shouldn't it recompute its size to take acount of the possibly longer or shorter text? On looking at the code I can't see why this is not happening. Should I be using a different function (eg gtk_widget_size_allocate) for this too or do I need to call another function to clear the cached size to cause the button (or whatever widget it is) to recalculate its preferred size?

Thanks for any advice anyone can offer....

Nick Allen
Software Engineer
Sun Microsystems Ireland Ltd
Hamilton House
East Point Business Park
Dublin 3

email: nicholas allen ireland sun com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]