Re: key press events and gtk_dialog_new_with_buttons()



Yeti,
Thanks for your response. I tried your suggestion, but it didn't seem to work. Note that I have three entry widgets in the dialogue box and the cursor can be inside of any of them when I want the enter key to act like the OK button. Would that make any difference? Also note that I am writing this in (for) Windows.

Thanks,
Richard.

At 19:32 10/01/06, you wrote:
On Tue, Jan 10, 2006 at 12:51:27PM +1100, rgipps netspace net au wrote:
> I have created a dialogue window using gtk_dialogue_new_with_buttons (see below)
> and attached a callback function to the "response" event.
>
> gtk_dialog_new_with_buttons("Y-Axis Scales",
>                             NULL,
>                             GTK_DIALOG_MODAL,
>                             GTK_STOCK_CANCEL,
>                             GTK_RESPONSE_CANCEL,
>                             GTK_STOCK_OK,
>                             GTK_RESPONSE_OK,
>                             NULL);
>
> If the Enter key is pressed I want the dialogue to act as if the OK button has > been clicked and if the Escape key is pressed to look like the Cancel button has
> been clicked.  What is the best way to go about doing this?

Add

  gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);

to make Enter activate OK instead of Cancel.
Escape already works.

Yeti


--
That's enough.
_______________________________________________
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]