Page 1 of 1

Working with Rich Edit

PostPosted: Thu Mar 09, 2006 12:23 pm
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. !!!!!!!!!

Temporary work around

PostPosted: Thu Mar 09, 2006 12:53 pm
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.

PostPosted: Thu Mar 09, 2006 5:55 pm
by Antonio Linares
Frank,

Modified as per your suggestion. Thanks! :)