Page 1 of 1

Hotkeys in Grid with ROWSOURCE

Posted: Sat Oct 29, 2016 7:19 pm
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.

Hotkeys in Grid with ROWSOURCE

Posted: Sun Oct 30, 2016 2:43 am
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.