Page 1 of 1
Edit Browse like Excel
Posted: Wed Apr 14, 2010 12:59 pm
by HECTOR
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
Re: Edit Browse like Excel
Posted: Thu Apr 15, 2010 9:17 am
by rdonnay
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