Hola
try directly from table (dbf)
Code: Select all
REDEFINE GET oGet ID 101 OF oDlg ;
UPDATE ;
PICTURE "@!"
oGet:bPostKey := {|oGet, cBuffer| setCliente( oget ) }
Code: Select all
//------------------------------------------------------------------------------
FUNCTION setCliente( oGet )
//------------------------------------------------------------------------------
LOCAL nPosItem := 0
LOCAL nPosCursor := oGet:nPos // Current cursor position
LOCAL nLength := LEN(oGet:cText) // Text length
LOCAL cStartTxt := LEFT(oGet:cText, nPosCursor-1) // Start text (position 1 to cursor position -1)
LOCAL cItem := ""
LOCAL nKey := 0
nKey := oGet:nLastKey
DO CASE
CASE nKey == VK_TAB .or. ;
nKey == VK_RETURN .or. ;
nKey == VK_DELETE
oGet:Assign() // Assign typed text
CASE nKey >= 32 .And. nKey <= 256
clientes -> ( DBEXIST( cStartTxt, "nombre", .T. ) )
cItem := clientes -> nombre
IF LEFT( cItem, LEN(cStartTxt) ) = cStartTxt
nLength := LEN( RTRIM( cItem ) )
cItem += SPACE( nLength - LEN(cItem) )
oGet:SetText( cItem )
oGet:SetSel( nPosCursor -1, nLength) // Select found text
oGet:oGet:Buffer = PAD( cItem, LEN( oGet:oGet:Buffer ))
RETURN(.t.)
ENDIF
oGet:HideSel() // Text not found -> Undo selected text
ENDCASE
RETURN( .T. )
This is not a generic solution, it's particular solution, I hope can be an start to solve your problem
regards
Marcelo