Re: [gtk-list] Re: Killing a window
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Killing a window
- Date: Tue, 28 Jul 1998 23:38:35 +0200 (CEST)
On Mon, 27 Jul 1998, Square Avenue wrote:
> 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.
there is a short-hand function that just does return TRUE and hides the window:
gtk_widget_hide_on_delete(). you use it as simply as
gtk_signal_connect (GTK_OBJECT (window),
"delete-event",
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete),
NULL);
>
> Hope this helps.
>
> - Dave
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]