Re: Questions on keyboard event
- From: carlos pehoe civil ist utl pt (Carlos Pereira)
- To: gtk-app-devel-list gnome org
- Subject: Re: Questions on keyboard event
- Date: Mon, 11 Aug 2003 14:55:09 +0100 (WEST)
What if I use gtk-1.2? Thanks.
I've created some buttons and buttons' callbacks. However, I would like
to bind some shortcut keys to the buttons. For example, "Ctrl-A" to
button1. Can anyone tell me how to do it?
This example is taken from my own (Gtk1.2) code,
---------------------------------
accel_group = gtk_accel_group_new ();
gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
gtk_widget_add_accelerator (menu_item, "activate",
accel_group, 'c', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
---------------------------------
First I create a menu_item and connect it to
some callback function, then I add a accelerator
group so pressing Ctr-C acts exactly as if the user
had activated the menu_item, so the callback is
triggered.
you might have to do some changes
when replacing the menu_item by a button,
(i.e. just replacing menu_item by button
and "activate" by "clicked" might not work,
you might have to use button_press_event
and button callbacks with three arguments)
Carlos
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]