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:
Hi,
I have a gtk-dialog built with glade with the two buttons Cancel and
Ok. When I push the ESC key on the keyboard the code behaves as I
clicked Ok with the mouse on the dialog and this is not correct.
How can I avoid this behaviour ?
--
Colossus
Cpsed, a Linux OpenGL 3D scene editor
Tim Müller 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