On 03-07-2022 13:35, Dejan Lekic wrote:
In my current code I have the following:
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.
So, I have two questions:
1) how to modify the above code to make SHIFT+F6 combination be handled instead?
2) Ultimately, in the distant future, I would like to make it possible for user to define this key combination, and persist it. So any guidance how to do this would be appreciated.
I believe it should work if you replace 'r' with GdkKeysyms.GDK_F6.
This constructor doesn't allow changing the keys during runtime, for
that you will want to use
MenuItem.setAccelPath and the related functions.