View Full Version : Gtk+ Window Management
fophillips
May 21st, 2007, 10:14 AM
When you destroy a window in Gtk, is there a simple way to get it back to its default without rebuilding everything from scratch on a button press?
For example: There is a window with three buttons, you close the window, click an icon in the system tray, the window appears again with the three buttons.
Thanks.
loell
May 21st, 2007, 10:20 AM
you can use gdk_window_hide
then use
gdk_window_show to show the window
fophillips
May 21st, 2007, 10:21 AM
But what about when a user closes the window?
loell
May 21st, 2007, 10:40 AM
i see, the usual situtaion.
i think you'll be using a function that returns a gtkwidget <-- the window , and in that function ,the window and other widget building is performed.
that way when it gets destroyed, an you want the window to be shown again, just call that function again to rebuild it then show it.
fophillips
May 21st, 2007, 11:10 AM
Thanks, works perfectly now.
duff
May 21st, 2007, 11:13 AM
you could also capture the close event, and prevent the window from being destroyed. That'll also save the state of the window, so you may need to reset the widgets.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.