Hi,
how can I define my own code blocks for some standard keys, e. g. K_RIGHT, , K_LEFT, K_DEL, or K_CTRL_DEL, in a xBrowse?
STATIC FUNCTION My_Keys( oBrw, nKey )
IF nKey >= 97 .AND. nKey <= 122
nKey := Asc( Upper( Chr( nKey ) ) )
ENDIF
IF nKey == K_CTRL_F .OR. nKey == Asc( Upper( "F" ) )
//
// Filter setzen
//
IF GetKeyState( VK_CONTROL )
My_Filter_FiveWin( oBrw )
ENDIF
ELSEIF nKey == K_CTRL_RETURN .OR. nKey == VK_RETURN
//
// Edit all marked records
//
IF GetKeyState( VK_CONTROL )
My_Edit_Dialogbox_FiveWin( oBrw )
ENDIF
ELSEIF nKey == K_CTRL_S
//
// Toggle security flag
//
Toggle_Schutz()
ELSEIF nKey == K_DEL .OR. nKey == VK_DELETE
//
// Delete records
//
IF GetKeyState( VK_CONTROL )
MsgInfo( "The function for the key 'Strg-Entf' (K_CTRL_DEL) is not yet implemented!" )
ELSE
MsgInfo( "The function for the key 'Entf' (K_DEL) is not yet implemented!" ) )
ENDIF
ELSEIF nKey == K_INS .OR. nKey == VK_INSERT
//
// Insert
//
IF GetKeyState( VK_CONTROL )
MsgInfo( "The function for the key 'Strg-Einfg' (K_CTRL_INS) is not yet implemented!" )
ELSE
MsgInfo( "The function for the key 'Einfg' (K_INS) is not yet implemented!" )
ENDIF
ELSEIF nKey == VK_CONTROL .OR. nKey == VK_RETURN
//
// Do nothing
//
ELSE
//MsgInfo( "The function for the key '" + AllTrim( Str( nKey ) ) + "' is not yet implemented!" )
ENDIF
RETURN nKey
As an alternative interface idea, consider making a right-click pop-up menu with all your options on it. This is a Windows standard and users will automatically try this. Unless your users are expert users that use the program a lot, they will not remember the hot-keys. At the very least consider doing both. All hot-key options should also be on a menu anyway for less than expert users.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 99 guests