Recent

Author Topic: [Solved]Menu shortcut keys for arrows  (Read 837 times)

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 630
    • Double Dummy Solver - free download
[Solved]Menu shortcut keys for arrows
« on: February 14, 2021, 09:11:58 pm »
I want the user to have the ability to move a row of data in a string grid up or down; basically swapping rows. What fits in well with the rest of the UI is Ctrl-UpArrow and Ctrl-DownArrow as the appropriate keys for these functions. This is easy to achieve using the OnKeyUp event of a stringgrid:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.GridKeyUp(Sender: TObject; var Key: word; Shift: TShiftState);
  2. begin
  3.   if (ssCtrl in Shift) and (Key in [38, 40]) then // Up/Down
  4.         MoveUpDown(Key = 38);
  5.  

I also want to user to be able to click on a dropdown menu to achieve this. Also easy.  What I CAN'T DO is assign any Ctrl-up/down arrows as a short-cut key for this menu action. Since the functionality has been obtained, all I need is the ability to have the menu up display "Ctrl-UpArrow" or better Ctrl-↑ in the appropriate place.

It there a better UI for this function - one that is popularly used? e.g Ctrl-U
« Last Edit: February 14, 2021, 10:31:19 pm by bobonwhidbey »
Lazarus 4.6 FPC 3.2.2 x86_64-win64-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Menu shortcut keys for arrows
« Reply #1 on: February 14, 2021, 09:24:01 pm »
What I CAN'T DO is assign any Ctrl-up/down arrows as a short-cut key for this menu action.

Yes, you can. They don't appear in the pick list but you can just type in "Ctrl+Up" or "Ctrl+Down". Or use the selection dialog to set them by clicking the "..." button (see attached image).
« Last Edit: February 14, 2021, 09:29:27 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 630
    • Double Dummy Solver - free download
Re: Menu shortcut keys for arrows
« Reply #2 on: February 14, 2021, 10:30:59 pm »
Perfect ;D
Lazarus 4.6 FPC 3.2.2 x86_64-win64-win32/win64

 

TinyPortal © 2005-2018