How can we activate the edit in the browse, like Excel and most of the windows application do, just writing with the keyboard, NOT typing first a ENTER key to begin the edition mode.
Best Regard
Nolberto Paulino
Edit Browse like Excel
Re: Edit Browse like Excel
This works for me:
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
STATIC snKey
FUNCTION Main()
LOCAL GetList[0], oBrowse, aDir, i
aDir := Directory()
FOR i := 1 TO Len(aDir)
aDir[i,1] := Pad(aDir[i,1],30)
NEXT
@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 30,10 FIT ;
EDIT xbeBRW_ItemSelected ;
HANDLER browseHandler
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 10 PARENT oBrowse
DCREAD GUI FIT HANDLER myHandler ;
EVAL {||SetAppFocus(oBrowse:getColumn(1))}
RETURN nil
FUNCTION MyHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )
IF nEvent == xbeP_Keyboard .AND. Empty(snKey)
IF oXbp:isDerivedFrom('DC_XbpBrowse') .OR. oXbp:isDerivedFrom('DC_XbpColumn')
PostAppEvent(xbeP_Keyboard,xbeK_ENTER,,oXbp)
snKey := mp1
ENDIF
ENDIF
RETURN DCGUI_NONE
FUNCTION BrowseHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )
IF oXbp == nil
RETURN DCGUI_NONE
ENDIF
IF oXbp:isDerivedFrom('DC_XbpGet')
IF nEvent == xbeP_SetInputFocus .AND. !Empty(snKey)
PostAppEvent(xbeP_Keyboard,snKey,,oXbp)
snKey := nil
ENDIF
ENDIF
RETURN DCGUI_NONE
PROC appsys ; return
The eXpress train is coming - and it has more cars.