Amigos:
Necesito un ejemplo de un xBrowse que al digitar
un nombre se mueva el browse hasta el nombre ese que se digita
Muchas gracias.
(Disculpen, me estoy cambiando de Browse)
Saludos y Gracias
Ruben Fernandez
..................
REDEFINE GET oGet VAR cText ID 801 PICTURE "@!" OF oDlg;
ON CHANGE ( Self:Assign(),;
Locator(""+SubStr(cText,1,Self:nPos-1)+Upper(Chr( nKey )),oLbx,cUsaBase) );
..................
************************************
FUNCTION LOCATOR(cKey,oB,cUsaBase)
************************************
// oB = TWBrowse Object, cKey = Contenido del Get
local nSeekrec
//
nSeekrec:=(cUsaBase)->(Recno())
cKey := SubStr(cKey,1,Len(cKey)-1)
//
IF GetASyncKey( VK_BACK )
cKey := SubStr(cKey,1,Len(cKey)-1)
EndIF
(cUsaBase)->(DbSeek(cKey,.T.))
If !Found()
GO nSeekrec
EndIF
//
oB:Refresh()
//
RETURN( NIL )
................
oLbx:bkeydown:={|nKey|DOKEYCHECK(nKey,oLbx)}
.................
******************************************************************
FUNCTION DOKEYCHECK(nKey,oBrw)
******************************************************************
*------SINGLE CHARACTER BROWSE SEARCHER----------------------
local cKEY, nSeekrec
nSeekrec:=recno() && Record number before the seek...
&& 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
cKey:=UPPER(CHR(nKEY)) && Change ACSII nKey value to a Character value
&& for the SEEK...
SET SOFTSEEK ON && Get as close as you can to the key value...
SEEK UPPER(cKey)
SET SOFTSEEK OFF && Reset softseek
oBRW:oVscroll:setpos(recno()) && Refresh browser object sequence...
oBRW:refresh() &&
SysRefresh()
RETURN( NIL ) && Drop out!
ENDIF
*-RECORD SELECTION AFTER A RETURN KEY HIT...POSSIBLY TO DROP TO EDIT WINDOW -*
DO CASE
CASE nKEY == VK_SPACE
//
CASE nKEY == VK_RETURN
//
ENDCASE
//
RETURN( NIL )
oBrw:bSeek := { | c | Alias->(DBSeek( c ), .T. ) } //el alias que quieras
oBrw:oSeek := oSay //El say que has creado antes, no es obligatorio
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 59 guests