Para Ralph del Castillo

Para Ralph del Castillo

Postby MGA » Wed Sep 03, 2008 7: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
MGA
 
Posts: 1254
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 30 guests