[9461] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Detecting window from button
daemon@ATHENA.MIT.EDU (Andreas Tille)
Wed Oct 21 04:23:45 1998
Date: Wed, 21 Oct 1998 10:23:08 +0200 (METDST)
From: Andreas Tille <tille@physik.uni-halle.de>
To: Martin Schulze <joey@infodrom.north.de>
cc: gtk-list@redhat.com
In-Reply-To: <19981019211458.C27466@finlandia.infodrom.north.de>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
On Mon, 19 Oct 1998, Martin Schulze wrote:
> Application X contains an entry field and two buttons. Whenever the
> OK button is pressed the content of the entry is tested. If the
> content isn't correct an error dialog pops up.
>
> The new dialog has a Close button. However the signal handler doesn't
> know which window to close. Storing one global variable for this very
> windows isn't a solution but a bad workaround.
>
> In connection to the above scenario I wonder how it would be possible
> to disable the OK button in the main dialog until the data is
> processed (and the window is closed anyway) or the error box is
> closed.
You can try to use
gtk_object_set_user_data(GTK_OBJECT(button), window);
and in the signal handler
window = gtk_object_get_user_data(GTK_OBJECT(button));
I've done this as first solution. In most cases when I've done this
I considered later, that I need the window only to destroy it. Than
it is easier to install a second signal handler for the button (after
the handler which does your job of course) which simply destroys the
window.
Kind regards
Andreas.
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null