[Gtk-sharp-list] Adding a shortcut to menu or a button

True Friend true.friend2004 at gmail.com
Sun Aug 24 00:59:25 EDT 2008


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?
Regards
-- 
Muhammad Shakir Aziz محمد شاکر عزیز
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080824/570e3e4e/attachment.html 


More information about the Gtk-sharp-list mailing list