...
...
REDEFINE GET oGet VAR cMaterial PICTURE "@K" ID 21 OF oDlg
REDEFINE BUTTON ID 42 FILENAME "SearchReg.bmp" OF oDlg ACTION Seek_Material (oGet,400,150 )
...
...
STATIC FUNCTION Seek_Material( oGet, nWidth, nHeight )
LOCAL oVen, vLbx, aPoint, cBus, n, xVal , bRestore, lNormal, oDbf
SELECT P119 ; __dbZap()
** EN ESTA SECCION YO LLAMO MIS DATOS Y LOS TRASLADO A LA DBF DE PASO
** ADAPTA AQUI LO QUE TU UTILICES MOSTRAR
oDbf:= oCon:Query("SELECT MA_CodeMaterial_PK, MA_NombreMaterial FROM MAE_Grupo_Materiales WHERE AND MA_Activo = 1 ")
oDbf:Query_All()
For n := 1 TO oDbf:nRecord
SELECT P119 ; dbAppend()
P119->MATE := oDbf:aDataAll[n][1]
P119->NOMB := oDbf:aDataAll[n][2]
Next ; oDbf:End()
*** HASTA AQUI
SELECT P119 ; INDEX ON P119->NOMB TAG 1 TO (".\TEMP\PASO119.CDX")
SET INDEX TO (".\\PASO119.CDX")
SELECT P119 ; DBGOTOP()
bRestore := {|| IIF( !lNormal, ( oGet:VarPut( xVal ), oGet:SetFocus() ), ), oVen:End() }
xVal := oGet:VarGet()
cBus := ""
lNormal := .F.
aPoint := AdjustWnd( oGet, nWidth, nHeight )
DEFINE WINDOW oVen FROM aPoint[1] + 1, aPoint[2] TO aPoint[1] + nHeight, aPoint[2] + nWidth pixel STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_BORDER )
@ 0, 0 LISTBOX vLbx FIELDS P119->MATE, P119->NOMB ;
HEADER "Codigo","Descripción" ALIAS "P119" FIELDSIZES 60,250 SIZE nWidth,nHeight OF oVen ;
COLOR CLR_BUSCAR ;
FONT aWFont[23] PIXEL ON CHANGE ( oGet:VarPut( P119->MATE ), oGet:refresh()) ;
ON DBLCLICK ( oGet:VarPut( P119->MATE ), oGet:refresh(), oGet:SetFocus(), oVen:End() )
vLbx:bKeyChar := { |nkey, nFlags| IIF(nKey >= 32,(cBus += CHR(nKey) , BuscarSeek( vLbx, cBus )),), IIF(nKey = 8 ,(cBus := LEFT(cBus,LEN(cBus)-1), BuscarSeek( vLbx, cBus )),) }
vLbx:bLostFocus := {|| ( oGet:VarPut( P119->MATE ), oGet:refresh() , oGet:SetFocus() ) }
vLbx:bKeyDown := {|nKey| IIF( nKey = 13, (lNormal := .T., eval( bRestore ) ), IIF( nKey = 27,(lNormal := .T., eval( bRestore) ), ) ) }
ACTIVATE WINDOW oVen ON INIT ( oVen:bLostFocus := {|| oVen:bLostFocus := nil, eval( bRestore ) } , vLbx:Refresh() ) VALID ( lNormal := .T. )
RETURN Nil
//-------------------------------------------------------------------------
STATIC FUNCTION BuscarSeek( vLbx, cBus )
SELECT P119 ; SEEK cBus SOFTSEEK
vLbx:UpStable() ; vLbx:Refresh()
RETURN .T.
//-------------------------------------------------------------------------