On Sun, Aug 24, 2008 at 12:59 AM, True Friend <[EMAIL PROTECTED]> wrote:
> Hi
> I am seeking a way to add shortcut (say to call file save method) in a menu
> item or a toolbar button or in a simple button. I cannot find a way to add a
> shortcut. I tried to capture the key press event like this.
> protected virtual void OnCombobox1KeyPressEvent (object o,
> Gtk.KeyPressEventArgs args)
>     {
>         if(args.Event.State == Gdk.ModifierType.ControlMask)
>         {
>             if(args.Event.Key == Gdk.Key.s)
>             {
>                 Gtk.FileChooserDialog fc=
>         new Gtk.FileChooserDialog("Choose the file to open",
>                                     this,
>                                     FileChooserAction.Open,
>                                     "Cancel",ResponseType.Cancel,
>                                     "Open",ResponseType.Accept);
>                 fc.Run();
>                 fc.Show();
>                 fc.Destroy();
>             }
>         }
> but I cannot get it worked either. Any ideas how to do this?

I don't have time for a full answer right now, but this is a good
starting point:

http://library.gnome.org/devel/gtk/stable/gtk-Keyboard-Accelerators.html
http://www.go-mono.com/docs/[EMAIL PROTECTED]

(For some reason GTK+ calls shortcuts "accelerators").

-- 
Michael Hutchinson
http://mjhutchinson.com
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to