Pasting into a Richtext control

Post Reply
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Pasting into a Richtext control

Post by reinaldocrespo »

Hi everyone.

I'm needing to insert richtext formated text into a richtext focused control. I'm trying to do it with a cut from one and then paste into the other.

Here is my code:

Code: Select all

	MemoWrit( cFile, cRtfTxt2BInserted )
	oMcrRtf := TRichEdit():New()
	oMcrRTF:LoadRTF( cFile )
	oMcrRtf:cFileName := cFile
	oMcrRtf:SetSel( 0, -1 )
	oMcrRtf:Copy()

	logfile( "trace.log", { cfile, oMcrRtf:GetText() } ) //debuging

	oMcrRtf:End()
	ferase( cfile )

	::oRtf:Paste()
	::oWnd:Setfocus()
	::oRtf:Refresh()
	::oRtf:SetSel( 0, 0 )
Where ::ortf is the focused rtf control where rtf formatted text is to be inserted.

The logfile instruction is only to monitor what text is inside oMcrRtf object. It is always empty eventhough cfile contains the rtf text allright. So obviously when :copy() is executed nothing is copied to the clipboard. I'm using :loadRtf( cfile ) in other places in my code without a problem. Why won't it work in this situation?

Can someone help?

Thank you,



Reinaldo.
Post Reply