gtk_widget_add_accelerator

2004-09-08 Thread Pramod Patangay

Hi All,

I am trying to add an accelerator. Here's a sample
code:

GtkWidget *w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *e=gtk_button_new_from_stock(GTK_STOCK_OK);
GtkAccelGroup *gag = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(w),gag);
g_signal_connect(G_OBJECT(e),clicked,G_CALLBACK(print),NULL);
guint mod = GDK_SHIFT_MASK;
mod |= GDK_CONTROL_MASK;
gtk_widget_add_accelerator(e,clicked,gag,'6',GDK_CONTROL_MASK|GDK_SHIFT_MASK,GTK_ACCEL_VISIBLE);
gtk_container_add(GTK_CONTAINER(w),e);
gtk_widget_show(e);
gtk_widget_show(w);


When the application is run, Ctrl+6 calls the callback
but not Ctrl+Shift+6. Any idea what's going on here?
(I am using GTK 2.0.9)

Thanks
-Pramod






__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


gtk_widget_add_accelerator

2004-08-17 Thread Pramod Patangay

Hi All,

I am having trouble with adding acclerators.
I want the Shift Ctrl Minus key to map to some
event.

Here's what I am doing:

gchar * label = ...;
GtkWidget *menuItemWidget =
gtk_menu_item_new_with_mnemonic(label);
...
GdkAccelGroup *accel = ... ;
AccelKey = 45; //for - key
accelMod = GDK_CONTROL_MASK | GDK_SHIFT_MASK;

gtk_widget_add_accelerator(menuItemWidget, activate,
accel, AccelKey, (GdkModifierType)accelMod,
GTK_ACCEL_VISIBLE);
g_signal_connect(G_OBJECT(menuItemWidget),
activate,
G_CALLBACK (ActivateCallback), (gpointer)somedata);

I also added an accelerator so that Shit Ctrl + key
is mapped to another event.

These two keys (ShiftCtrlPlus and ShiftCtrlMinus) are
part of menus and I can see the shortcuts as part of
the menu names but the Shift Ctrl Minus does not
work instead Ctrl Minus emits the signal. No such
problem exists for Shift Ctrl Plus key.

Any idea what might be going wrong?

Thanks




__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list