Re: [gtk-list] Accelerators again
- From: Klaehn t-online de (Joachim Klaehn)
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Accelerators again
- Date: Thu, 12 Aug 1999 17:13:35 +0200
Nils Rennebarth wrote:
> Noone answered my question about accelerators yet, so here it is again:
>
> How do make pressing a certain key (on the keyboard) in my application
> to do the same as klicking a button?
>
> I.e.: there is a button:
>
> button=gtk_button_new_with_label("Quit");
> gtk_signal_connect(GTK_OBJECT(button), "clicked",
> GTK_SIGNAL_FUNC(delete), NULL);
>
> and I would like to make pressing "q" to do the same, that is to call the
> delete function.
>
> How do I do this?
>
> Nils
>
Hello Nils,
I´m doing the job in this way:
GtkWidget *window;
GtkAccelGroup *AccelGroup;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
AccelGroup = gtk_accel_group_new ();
gtk_accel_group_attach (AccelGroup, GTK_OBJECT (window));
button=gtk_button_new_with_label("Quit");
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(delete), NULL);
gtk_widget_add_accelerator(button,"clicked",&AccelGroup,
GDK_q,0,
GTK_ACCEL_VISIBLE|GTK_ACCEL_SIGNAL_VISIBLE);
good luck
Achim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]