Olá a todos !!
Estou com um problema de pesquisa com a Tsbrowse 8., so faz a pesquisa da primeira letra, as demais não tem ação. Com a TsB 7 funcionava normal. Segue abaixo o prg, se alguem puder me dizer onde esta errado ou mostrar um outro caminho fico agradecido.
//------------------------//
#define _VIDEO_CH
#define _OBJECTS_CH
#define _DDE_CH
//
#include "TSBrowse.ch"
#include "FiveWin.ch"
// uncomment the next line for using ADS/Harbour RDD
//#include "ADS.ch"
#define CLR_PINK nRGB( 255, 128, 128)
#define CLR_NBLUE nRGB( 128, 128, 192)
#define CLR_NBROWN nRGB( 130, 99, 53)
#define CLR_1 nRGB( 190, 215, 190 )
#define CLR_2 nRGB( 230, 230, 230 )
#define CLR_3 nRGB( 217, 217, 255 )
//
REQUEST DBFCDX, DBFFPT
Static oWnd, oIco, aWChild, aFont[ 5 ], aBrush[ 8 ], aBmp[ 6 ]
//----------------------------------------------------------------------------//
Function Main()
//----------------------------------------------------------------------------//
Local oBmp, oBar, cTitle, oBtn[ 9 ], aColor[ 2 ], ;
lNoBlink := .F.
//
Local oDlg, oFld, oBrw[ 7 ], oCol, aRect, nEle, bBlock, oMsg, ;
nMarried := 0, ;
nSingle := 0, ;
nTotSal := 0, ;
nAgeTot := 0, ;
nOldAge := 0, ;
nOldSal := 0, ;
aStates := {}
PRIVATE cChav:="",oChar,cChar:=SPACE(20)
//
Field First, Last, Married, Age, Salary, State
//
RddSetDefault( "DBFCDX" ) // Clipper-Harbour
cTitle := "TSBrowse ! The Power of Columns ! "
USE Employee SHARED NEW
Index On First+Last Tag Name // CDX
Index On State Tag State // CDX
OrdSetFocus( "Name" ) // CDX
//Setdebug()
aWChild := Array( 8 )
SET _3DLOOK ON
SET EPOCH TO Year( Date() ) - 60
DEFINE BITMAP oBmp RESOURCE "Cover" OF oWnd
DEFINE ICON oIco RESOURCE "SuperBrw"
DEFINE WINDOW oWnd TITLE cTitle ;
COLORS CLR_BLACK, CLR_BLUE
DbEval( { || nAgeTot += Age } )
DbGotop()
//
DEFINE DIALOG oDlg RESOURCE "DIALOG_1" BRUSH aBrush[ 8 ]
//
RedeFine Get oChar VAR cChar PICTURE "@!" Id 101 ;
Of oDlg ;
ON CHANGE Pesquisa(nKey,"EMPLOYEE",oBrw[ 4 ],oChar)
//
REDEFINE BROWSE oBrw[ 4 ] GRID ALIAS "Employee" ;
COLORS CLR_BLACK,CLR_PINK ;
ID 110 OF oDlg FONT aFont[ 1 ] ;
MESSAGE "Fonts, colors and bitmaps different for cells, headers and footers"
//
ADD COLUMN TO oBrw[ 4 ];
HEADER "F i r s t" ;
SIZE 130 ;
DATA FieldWBlock( "First", Select() )
ADD COLUMN TO oBrw[ 4 ];
HEADER "Last" + CRLF + "Name" ;
DATA FieldWblock( "Last", Select() )
oBrw[ 4 ]:SetIndexCols( 1, 2 )
// when working with the same database this is very important
oBrw[ 4 ]:lNoResetPos := .F.
//
REDEFINE BUTTON ID 210 OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT oMsg := TMsgBar():New( oDlg, "TSBrowse El poder de las columnas." )
Return Nil
//----------------------------------------------------------------------------//
FUNCTION Pesquisa(nKey,Alias,oBrw,oSay)
//----------------------------------------------------------------------------//
LOCAL nOldRecno:=(Alias)->(Recno())
MSGINFO(OSAY)
IF nKey==VK_BACK
IF LEN(cChav) > 0
cChav:=LEFT(cChav,LEN(cChav)-1)
cChar:=cChav
ELSE
cChar:=SPACE(20)
oSay:SetPos(0)
RETURN(.F.)
END
END
IF (nKey>=32 .AND. nKey<=255) .OR. nKey=VK_BACK
IF nKey!=VK_BACK
cChav+=CHR(nKey)
END
IF !(Alias)->(dbSeek(TRIM(cChav)))
(Alias)->(dbGoto(nOldRecno))
END
(oBrw:SetFocus(),oBrw:Refresh(),oSay:SetFocus())
oSay:SetPos(LEN(oSay)+1)
END
IF nKey#VK_BACK
cChar:=IF(LEN(cChav)#0,cChav,SPACE(20))
oSay:SetPos(LEN(cChar)+1)
END
RETURN(.T.)
//----------------------------------------------------------------------------//
Desde já, obrigado a todos e um grande abraço !