Page 1 of 1

Pasting into a Richtext control

PostPosted: Sat Feb 11, 2006 3:26 pm
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  Expand view
   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.