Hotkeys in Grid with ROWSOURCE

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Hotkeys in Grid with ROWSOURCE

Post by KDJ »

These hotkeys are available when ROWSOURCE is specified:
Alt+A --> Append
Alt+D --> Delete
Alt+R --> ReCall
Alt+S --> Save
Alt+U --> ClearBuffer

Unfortunately, in this case Ctrl and Shift also works (Ctrl+Alt+A, Ctrl+Shift+Alt+A, ...).
Request to disable Ctrl and Shift.

I looked at the source code (h_windows.prg, line 2873 and next):

Code: Select all

  Case GetGridvKey (lParam) == 65  // A 
     if GetAltState() == -127 .or. GetAltState() == -128   // ALT
        IF _HMG_SYSDATA [ 40 ] [ i ] [ 12 ] == .T. .AND. VALTYPE(_HMG_SYSDATA [ 40 ] [ i ] [ 10 ] ) == 'C'
           DataGridAppend(i)
        ENDIF
     Else
        // Return 1
     EndIf
Can be replaced with:

Code: Select all

  Case GetGridvKey (lParam) == 65  // A 
     if (GetAltState() < 0) .and. (GetKeyState(VK_CONTROL) >= 0) .and. (GetKeyState(VK_SHIFT) >= 0)
        IF _HMG_SYSDATA [ 40 ] [ i ] [ 12 ] == .T. .AND. VALTYPE(_HMG_SYSDATA [ 40 ] [ i ] [ 10 ] ) == 'C'
           DataGridAppend(i)
        ENDIF
     Else
        // Return 1
     EndIf
Similarly for Alt+D, Alt+R, Alt+S and Alt+U.

It would be useful also to add possibility to disable all these hotkeys (Alt+A, Alt+D, Alt+R, Alt+S, Alt+U) in Grid by a new property (eg. HotkeysEnabled):
Grid.HotkeysEnabled := .T.
Grid.HotkeysEnabled := .F.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Hotkeys in Grid with ROWSOURCE

Post by Pablo César »

Yes KDJ, good idea ! :)

Sometime we do not want users to make append/edit/delete/recall of grids...

Thank you KDJ for this wishlist.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply