Label Buddies
RobertBColton opened this issue · 0 comments
If you look at the editors in GM sometimes you'll see a label with an underlined character. Those are the label buddies and they are keyboard accelerators such that if you press the key of the letter the buddy of the label is focused.
All we need to do is parse the message translations to remove ampersand, and escape actual ampersands with an ampersand. The ampersand format comes from Windows I believe, it is supported in Windows Forms. Regardless, the format is universeal here and everybody, even Qt Framework handles it the same. Then we just set the Mnemonic index and call label.setLabelFor
to associate it to a component.
We can even see that Oracle has its own utilities for this, though not part of regular JDK.
https://docs.oracle.com/cd/A97329_03/web.902/q20211/oracle/jbo/common/ResourceUtils.html