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

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Aug 26 14:11:31 EDT 2008


On Tue, Aug 26, 2008 at 1:11 PM, Andy Selvig <ajselvig at gmail.com> wrote:
> I've put together a very basic sample that tries to use accelerators.
> Clicking on the menu item's call the methods appropriately, but the
> accelerators don't work. I used AccelMap.AddEntry() to map the
> accelerators to paths, then told the menu items what their accelerator
> paths were. Is more needed? I still can't figure out how to use
> AccelGroup, as I don't know how to make an IntPtr closure (notice the
> ??? in the accelGroup.Connect() calls). The documentation for
> AccelGroup says to use ItemFactory, but the documentation for
> ItemFactory has "Obselete" and "Do not use" in it.
>
> The sample code is attached. Help on this would be great, it doesn't
> seem like it should be this complicated.

I'm not familar with Accelerators, but you could look at the code
generated by Stetic.

Another option is to use Action Groups, which can have accelerators,
and bind those to your toolbars/menus/whatever.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list