FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Para Ralph del Castillo
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
Para Ralph del Castillo
Posted: Wed Sep 03, 2008 07:23 PM

Ralph, estou usando a TDOSPRN com Preview modificada por vocĂȘ. Gostaria de saber se Ă© possĂ­vel implementar uma busca de palavras dentro do PREVIEW.

Tentei assim:


METHOD TratSeekpage() CLASS TTxtPreview


Local odlg,ocam

DEFINE DIALOG odlg RESOURCE "PESQPALAVRA" FONT ownd:ofont

REDEFINE GET ocam var cArq ID 100 of odlg

REDEFINE BUTTON ID 110 OF odlg ACTION(::SeekPage(cArq),sadld:END() )
REDEFINE BUTTON ID 120 OF odlg ACTION(odlg:end()) cancel

ACTIVATE DIALOG odlg centered
return(.t.)

METHOD SeekPage(cPalavra) CLASS TTxtPreview

Local lOk:=.F.
cPalavra :=alltrim(cPalavra)
do while !( ::oDbf:Eof() )
if cPalavra $ ::oDbf:Text
if (AT(cPalavra,::oDbf:Text))>fwhnpos
lOk:=.T.
exit
endif
Endif
::nPage++
::oDbf:Skip(1)
enddo

IF lOK

fwhnpos:=AT(cPalavra,::oDbf:Text)
::oFGet:Settext(::TxtToRTF( ::oDbf:Text ))
::oPage:SetText( "PĂĄgina nÂș: "+TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) + ;
                 " / " + LTrim( Str( ::oDbf:RecCount() ) ) )
::oFGet:setpos(fwhnpos)
::oFGet:Setsel(fwhnpos,fwhnpos+len(cPalavra))   //selecionar parte do texto
::oFGet:Refresh()
::oFGet:SetFocus()

else
msg("Fim da pesquisa !!!")
cArq :=space(60)
fwhnpos:=0
::nPage:=1
::oDbf:GoTop()
::oFGet:Settext(::TxtToRTF( ::oDbf:Text ))
::oPage:SetText( "PĂĄgina nÂș: "+TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) + ;
" / " + LTrim( Str( ::oDbf:RecCount() ) ) )
::oFGet:Refresh()
::oFGet:SetFocus()
endif
return nil

Mais nĂŁo posiciona corretamente em cima da palavra procurada.

Sabe como resolver?

ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
PellesÂŽC
TDolphin

Continue the discussion