In my current code I have the code
MenuItem runFileItem = new MenuItem(
(MenuItem mi) => pm.runFile(),
"_Run file",
"activate", true, accelGroup, 'r',
ModifierType.CONTROL_MASK | ModifierType.SHIFT_MASK,
AccelFlags.VISIBLE);
which works as expected - I can execute the handler pm.runFile() by pressing CTRL+SHIFT+r. Reason why I did it this way is because I could not figure out how to implement the preferred SHIFT+F6 that I wanted to use for this purpose. It would be good if I could put GDK_F6 GDK Keysym (from the gdk.Keysyms
module), but could not find a way to use it. I've also asked the same question on GtkD forum (https://forum.gtkd.org/groups/GtkD/thread/2976/) without luck.
So the question is how to modify the above code to make SHIFT+F6 combination be handled properly as originally planned?
UPDATE: Based on Adam's answer, the following code works:
MenuItem runFileItem = new MenuItem("_Run file", (MenuItem mi) => pm.runFile(), "activate");
runFileItem.addAccelerator("activate", accelGroup, GdkKeysyms.GDK_F6, ModifierType.SHIFT_MASK, AccelFlags.VISIBLE);
This constructor you're calling: https://api.gtkd.org/gtk.MenuItem.MenuItem.this.3.html
Forwards some of its arguments to this function on the base class:
https://api.gtkd.org/gtk.Widget.Widget.addAccelerator.html
Notice the ctor takes char
but that other function takes uint
so it should be able to take more values.
So I'd suggest trying:
auto mi = new MenuItem(label, action);
mi.addAccelerator(
"activate", accelGroup, GDK_F6,
ModifierType.SHIFT_MASK,
AccelFlags.VISIBLE
);
and see if it works.