Using a LanguageTextField in a Preferences dialog - Tab key issue Follow
I'm creating a plugin where some of the settings will be handled by entering JSON. I'm using a LanguageTextField, and it's working fairly well, but I can't use the Tab key for indenting text - the Tab key ends up functioning for navigation instead.
I tried doing this:
newJsonConfig.focusTraversalKeysEnabled = false
...but that had no effect. Any suggestions about what would work?
Please sign in to leave a comment.
I came up with a solution, but I sure hope that there's something easier than this. Solving the problem required setting focusTraversalKeysEnabled on an inner component of the LanguageTextField, then adding a key listener to that component to handle indentation via keyboard events.
What's odd is that one form of indentation - forward indentation of a selection - was automatically handled as soon as focusTraversalKeysEnabled was false. But forward indentation from an insert cursor was not handled, nor any form of unindenting.
The code below was needed to solve other problems too, like that fact that some of the configuration of a LanguageTextField can't be done as soon as you create an instance - you have to wait until the component has been displayed before it has an editor to accept some of the settings, like isLineNumbersShown, and the focusTraversalKeysEnabled attribute of the content of the editor.