|
|
| Author |
Message |
|
|
joshl
Joined: 12 Apr 2007 Posts: 3
|
Posted: Tue Jun 05, 2007 9:01 pm Post subject: GtkExpander help |
|
|
| I am sure this is simple but I haven't figured it out yet. I have a widget in a GtkExpander, when I collapse the expander I would like my window to resize to reclaim the space. How is it done? |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 426 Location: Portland, OR USA
|
Posted: Tue Jun 05, 2007 11:45 pm Post subject: |
|
|
Hmmm. I know that if you were to make the window fixed using gtk_window_set_resizable(GTK_WINDOW(window), FALSE) then the window would react (snap closed around) the GtkExpander widget. However, I don't know how this would be done with a sizable window.
Furthermore, if you are using a resizable window, changing it's size programatically in response to the GtkExpander may prove annoying to the end user as they could potentially have sized the window to a preferred size. |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 376 Location: State College, Pennsylvania
|
Posted: Tue Jun 05, 2007 11:48 pm Post subject: |
|
|
| If you get the height of the GtkExpander's child, then you could possibly just subtract that height from the height of the window when it is contracted. Then, do the same thing when it is expanded again. You have to do this because GTK+ will only resize the window after created unless necessary. |
|
| Back to top |
|
 |
joshl
Joined: 12 Apr 2007 Posts: 3
|
Posted: Wed Jun 06, 2007 4:32 pm Post subject: |
|
|
| Thanks for the suggestions. Making the window fixed works great with GtkExpander, however I would like the users to be able to resize the window. I tried Andrew's method of setting a new size based on the widow's size - child's size using gtk_window_resize(). Then I invalidate the window using gtk_widget_queue_draw_area(). However this has no effect. Is there a better way to get the window redrawn? |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 376 Location: State College, Pennsylvania
|
Posted: Wed Jun 06, 2007 9:32 pm Post subject: |
|
|
| gtk_widget_set_size_request() |
|
| Back to top |
|
 |
|