Hola.
Me gustaría saber si se puede hacer con xBrowse, para que los resultados se actualicen inmediatamente según se escribe.
Vídeo de ejemplo: http://www.mediafire.com/?dxm8190tuai1yem
Gracias
//----------------------------------------------------------------------------//
//GetLookUp(nKey, nFlags, oGet, cCampo, cTag ) Busca en una tabla, en el indice cTag, oGet:VarGet
//si lo encuentra rellena a oGet con el resto del campo
FUNCTION GetLookUp(nKey, nFlags, oGet, cCampo, cTag, lLast )
LOCAL nPos
//LOCAL cOrden, nRecno
if nKey = 46 .AND. (nFlags = 22216705 .OR. nFlags = 1095958529) //Del key (nFlags=22216705->1 pres, nFlags=1095958529=multiple pres)
Return NIL
endif
IF VALTYPE(oGet:VarGet())$"CM" .AND. nKey >= 32 .AND. nKey <= 255
nPos:=oGet:nPos
oGet:Assign()
//nRecno:=Recno()
//cOrden:=OrdSetFocus(cTag)
OrdSetFocus(cTag)
//IF DBSeek(UPPER(LEFT(oGet:VarGet(),nPos-1)),,lLast)
IF DBSeek(LEFT(oGet:VarGet(),nPos-1),,lLast)
oGet:cText( Compile(cCampo) )
ELSE
//oGet:cText( PADR(UPPER(LEFT(oGet:VarGet(),nPos-1)), LEN(Compile(cCampo))) )
oGet:cText( PADR(LEFT(oGet:VarGet(),nPos-1), LEN(Compile(cCampo))) )
ENDIF
oGet:SetPos(nPos)
//OrdSetFocus(cOrden)
//DBGoTo(nRecno)
ENDIF
RETURN oGet
oGet:bChange := {|nKey, nFlags, oGet| CLIE_VIEW->(GetLookUp(nKey, nFlags, oGet, "CODIGO", "CODIGO" )) }
oGet:bChange := {|nKey, nFlags, oGet| CLIE_VIEW->(GetLookUp(nKey, nFlags, oGet, "NOMBRE", "NOMBRE" )) }
......
oBj1[9]:bkeydown:={|nKey|DOKEYCHECK(nKey,oBj1[9],oSay2,oDlg,oBj1,@cTecla)}
......
************************************************************
STATIC FUNCTION DOKEYCHECK(nKey,oLbx,oSay2,oDlg,oBj1,cTecla)
************************************************************
*------SINGLE CHARACTER BROWSE SEARCHER----------------------
&& Note ASCII values: 65-90 are Capital A through Z.
&& : 97-122 are lowercase a through z.
&& : 48-57 are numbers 0-9.
&& : 13 used below is for a RETURN key hit.
//
IF nKEY>=65 .AND. nKEY<=90 .OR. nKEY>=97 .AND. nKEY<=122 .OR. nKEY >=48 .AND. nKEY<=57 .OR. nKey = VK_SPACE
//
//cKey:=cKey+UPPER(CHR(nKEY))
cTecla:=cTecla+UPPER(CHR(nKEY))
//
oSay2:SetText(cTecla)
oSay2:Refresh()
FilTexto(cTecla,"AGENDA",oDlg,oLbx)
oLbx:oVscroll:setpos(recno()) && Refresh browser object sequence...
oLbx:refresh() &&
oLbx:UpStable() && Stablize
SysRefresh()
RETURN( NIL ) && Drop out!
ENDIF
//
DO CASE
*/
CASE nKEY == VK_BACK
//
cTecla=substr(cTecla,1,len(cTecla)-1)
FilTexto(cTecla,"AGENDA",oDlg,oLbx)
oSay2:SetText(cTecla)
oSay2:Refresh()
CASE nKEY == VK_DELETE
//
cTEcla=""
FilTexto(cTecla,"AGENDA",oDlg,oLbx)
oSay2:SetText(cTecla)
oSay2:Refresh()
CASE nKEY == VK_RETURN
(AgendaAltaModi(oLbx,"Ver/Modificar texto",.F.),oLbx:Refresh(),oLbx:SetFocus())
//
CASE nKEY == VK_INSERT
(AgendaAltaModi(oLbx,"Alta de nuevo registro",.T.),PonNumero("AGENDA",oBj1),oLbx:Refresh(),oLbx:SetFocus())
//
CASE ( nKey == Asc( "F" ) .OR. nKey == Asc( "f" ) ) .AND. GetKeyState( VK_CONTROL )
ENDCASE
//
RETURN( NIL )
******************************************
FUNCTION FilTexto(cFiltro,cFile,oDlg,oLbx)
******************************************
cFiltro := ALLTRIM(cFiltro)
IF ! EMPTY(cFiltro)
(cFile)->(DBSETFILTER({|| AT(UPPER(cFiltro), UPPER((cFile)->Texto)) > 0 },"AT(UPPER(cFiltro), UPPER((cFile)->Texto)) > 0" ))
ELSE
(cFile)->(DBCLEARFILTER())
ENDIF
(cFile)->(DBGOTOP())
oLbx:Refresh()
oDlg:Update()
RETURN(.T.)
acuellar wrote:Thanks G. N. Rao.
Very good the sample
You can do with Scope
Regards,
Adhemar
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 21 guests