[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GTK dialog ESC key problem
- From: Christopher Anderson <sidewinder asu gmail com>
- To: Tim Müller <zen18864 zen co uk>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GTK dialog ESC key problem
- Date: Tue, 28 Jun 2005 10:07:25 -0700
The problem is that, as Tim said, hitting cancel emits a
GTK_RESPONSE_DELETE_EVENT, not a GTK_RESPONSE_CANCEL. So with your
code, if the user hits escape, your if statement will go to the "ok"
part. Here's what you should use instead:
switch (response) {
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_NONE:
/* Cancel behaviour here */
break;
case GTK_RESPONSE_OK:
/* Ok behaviour here */
break;
}
Cheers,
Chris Anderson
On 6/27/05, Tim Müller <zen18864 zen co uk> wrote:
> On Monday 27 June 2005 13:53, Colossus wrote:
>
> > > It should actually act as if you clicked the Cancel button, ie. emit a
> > > dialog response with GTK_RESPONSE_CANCEL and return that as value in
> > > gtk_dialog_run() if you are using gtk_dialog_run(). In other words: you
> > > probably need to fix your code to check the response values correctly.
> >
> > (snip code)
> > // it goes here, where is my mistake ??
>
> Sorry, my mistake. Pressing the Escape key will emit the 'close' signal and
> will have the same effect as if the user hit the 'X' in the window frame, so
> you will get a GTK_RESPONSE_DELETE_EVENT. This will only work if there is a
> button with a GTK_RESPONSE_CANCEL response though.
>
> Hope I got it right this time ;)
>
> Cheers
> -Tim
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]