Re: [gtk-list] Detecting window from button
- From: Andreas Tille <tille physik uni-halle de>
- To: Martin Schulze <joey infodrom north de>
- cc: gtk-list redhat com
- Subject: Re: [gtk-list] Detecting window from button
- Date: Wed, 21 Oct 1998 10:23:08 +0200 (METDST)
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]