TListBox refinement
Posted: Mon Feb 06, 2006 8:44 am
The following sample shows that the Return key is not trapped by bKeyDown codeblock:
A possible solution is to add the following method to TListBox class:
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oLbx
LOCAL cVar := ""
DEFINE DIALOG oDlg
@ 1, 1 LISTBOX oLbx VAR cVar ITEMS { "Bert", "Carl", "William" }
oLbx:bKeyDown = { | nKey | MsgInfo( nKey ) }
@ 3, 1 BUTTON "&Close" ACTION oDlg:End()
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
Code: Select all
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TListBox
if nMsg == WM_GETDLGCODE .and. nWParam == VK_RETURN
::oWnd:nLastKey := VK_RETURN
return Super:KeyDown( nWParam, nLParam )
endif
return Super:HandleEvent( nMsg, nWParam, nLParam )