Working with Rich Edit

Post Reply
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Working with Rich Edit

Post by Frank Demont »

Antonio,

I am succesfull with using this class , printing multiple rtf- files

Now , i have a routine to convert txt-files with esc-sequences to rtf format , it works very fine except :



I have to use oRtf:find(......) . When nothing is found (i have to loop trought the text till no escape sequenses are found) , i got a message. This can not be the intention.

I expect a construction as :

DO WHIL oRtf:Find( Esc-sequens ON , .T. ) // Bold on
nFrom := oRtf:GetPos()
oRtf:ReplaceSel( .F. , "" )
oRtf:Find( Esc-sequens OFF , .T. ) // Bold Off
nTo := oRtf:GetPos()
oRtf:ReplaceSel( .F. , "" )
oRTF:SetSel(nFrom , nTo , .T.)
oRtf:SetBold( .T. )
END


Important is that method find returns .T. or .F. !!!!!!!!!
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Temporary work around

Post by Frank Demont »

@ 0, 0 RICHEDIT oRTF VAR cRTF OF oWnd ;

__ObjModMethod(oRtf,"Find",@Find())




FUNCTION Find( cFind, lDown, lCase, lWord )

LOCAL Self := HB_QSelf()

local nIndex := REFindText( self:hWnd, cFind, lDown, lCase, lWord )

if nIndex != -1
RESetSelection( self:hWnd, nIndex + Len( cFind ), nIndex )
self:Change()
else
//MsgInfo( "String not found: " + cFind, "Find" )
RETURN .F.
endif

return .T.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Frank,

Modified as per your suggestion. Thanks! :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply