Hi Nicolai,
thanks for your answer! However, apparently the problem is a bit different: the shortcut I wanted to add, cmd-s, already existed but I did not realize it! I want to add cmd-s to save the text to a file, but the editor has auto accept set to true and cmd-s calls accept by default. So adding another cmd-s did not do anything and neither could I see that the existing cmd-s binding was executing some other behavior :-/
After seeing this, I expected that I would be able to remove the cmd-s keybinding, using removeKeyCombination: but apparently I cannot (see example below).
In general, it���s not nice to discover from the code that there are keyboard shortcuts that are not listed in the context menu. The enduser should be able to discover all active keybindings from what is visible in the UI and this is not the case here. Maybe I���ll make a subclass of RubTextEditor that only reimplements buildShortcutsOn: so that it is without all these hidden keybindings.
But for now I���ll add cmd-d to do save ��� although that���s ugly. :-(
| window text |
text := RubScrolledTextMorph new.
"define a custom shortcut"
text removeKeyCombination: $s command.
text on:$s command do:[
text setText: text text asString reverse].
window := StandardWindow new.
window addMorph: text fullFrame: (0@0 corner: 1@1) asLayoutFrame.
window title: 'Example'.
window openInWorld.