Sign in Join
Wiki copytemporary

New LCL shortcut system: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11This page collects ideas about improving system of shortcuts in LCL.
22
33## Current state
44
55``` pascal
66TShortCut = Low(Word)..High(Word); // in classes.pp unit
77
88// virtual key codes VK_*
99Key := ShortCut and $FF;
1010
1111// key modifiers
1212Meta := ShortCut and $1000; // scMeta
1313Shift := ShortCut and $2000; // scShift
1414Control := ShortCut and $4000; // scControl
1515Alt := ShortCut and $8000; // scAlt
1616```
1717
1818Unused bits in TShortCut: \$0F00
1919
2020## Requirements
2121
22221. backward compatibility
2323 - accept current TShortCut format
2424 - new format can use only unused bits in current TShortCut format
25252. secondary, ternary shortcuts
26-3. platform-specific shortcuts (E.g. <span class="kbd">Ctrl</span>+<span class="kbd">C</span> under Windows, <span class="kbd">Cmd</span>+<span class="kbd">C</span> under Mac OS X)
27-4. shortcuts also with characters (E.g. <span class="kbd">Cmd</span>+<span class="kbd">?</span>)
26+3. platform-specific shortcuts (E.g. `Ctrl`+`C` under Windows, `Cmd`+`C` under Mac OS X)
27+4. shortcuts also with characters (E.g. `Cmd`+`?`)
2828
2929## Conclusion
3030
3131- create list of extra shortcut data under TApplication (TLCLShortCutList)
3232- the TShortCut value would be "an index" to one item in this list, unused bits can distinguish different shortcuts with same key code (0 will be reserved for old version)
3333- modify shortcut handling in TApplication, TForm, TAction and TMenuItem
3434 - check for character shortcuts in IntfUTF8KeyPress
3535- add functions like ShortCutToText to TApplication
3636- modify TShortCut component editor
3737
3838### TLCLShortCut class
3939
4040- index - TShortCut with modified unused bits
4141- priority list of TLCLShortCutItem
4242 - key modifiers
4343 - platform modifiers
4444 - key or UTF-8 character
4545
4646---
4747*From the Free Pascal wiki, page "New LCL shortcut system", as it stood on 2020-02-21 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
4848Category: LCL
4949Category: Proposals

Back to history