Re: [gtk-list] Killing a window



On Mon, 27 Jul 1998, Jeremy Wise wrote:

> I am keeping track of a CList which is modified by many different
> functions, sort of like a logfile.  I have a toggle button, and when it is
> "toggled on," a window is shown with gtk_widget_show() which the CList is
> attached to, and if the button is toggled off, then gtk_widget_hide() is
> called.  This works fine, but when you close the window (by clicking the X
> on its titlebar), I can no longer access the CList.  What is the best way
> to ensure that clicking the toggle button will show/hide the window, and
> that the CList will not be destroyed when/if the window is?

Check out helloworld.c in the examples directory in your GTK distribution.
Essentially you have to attach the "delete" signal to a function that
returns a gint.  If you return TRUE, clicking on the X will send the
"delete" signal, but GTK won't actually delete the window.

If you still want the window to close, simply call gtk_widget_hide in the
same function, and the window will go away (to the user) but a subsequent
gtk_widget_show will bring it back again.

Hope this helps.

                                      - Dave

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Name:  David Finton                  | "Don't be afraid you'll make really
 Email:  dfinton@d.umn.edu             |  dumb mistakes.  Sometimes really
   Web:  http://www.d.umn.edu/~dfinton |  dumb mistakes are the only way to
                                       |  learn the really fundamental and
                                       |  important lessons in life."
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




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