Page 1 of 1

Getting the texxt of an RichEdit control

Posted: Tue Nov 01, 2016 10:29 pm
by plantenkennis
I have a window with a richedit control. How can I get the value of the text.
oGet:GetString gives an error
oGet:GetText gives the text without the RichEdit codes (bold, Italic...)
This is my code:

Code: Select all


cTekst := {\rtf1\ansi\ansicpg1200\deff0\deflang1043{\fonttbl{\f0\fnil\fcharset0 TIMES NEW ROMAN;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs24 Bij deze fraaie plant is het jonge blad roze gekleurt. Later verkleurt dit blad naar groen met een cr\'e8mewitte rand. De jonge takken zijn opvallend rood gekleurt, wat goed contrasteerd met het fris gekleurde blad.\par
}
FUNCTION RK_EditRichNotes(cTekst)

   LOCAL oDlg, cText := ''
   LOCAL oGet
   
   DEFINE DIALOG oDlg TITLE 'Aantekening' FROM 0, 0 TO 500, 600
      
   @ 35, 20 GET oget VAR cText MEMO OF oDlg ;
      SIZE 560, 460
      
    oGet:SetRichText(.t.)
    oGet:SetImportGraf(.t.)
    oGet:AddHRuler()
    oGet:SetUndo(.t.)      
    cText := cTekst
    oGet:SetAttributedString(cText)
    oGet:GoTop()
           
          
   @ 5, 500 BUTTON 'Ok' OF oDlg ACTION (cText := oGet:GetText, oDlg:END())
   
ACTIVATE DIALOG oDlg CENTERED
     MsgInfo(ctext)    
RETURN NIL
 

Re: Getting the texxt of an RichEdit control

Posted: Wed Nov 02, 2016 4:31 pm
by Antonio Linares
René,

I have implemented a new Method:

oMemo:GetRTF() --> cRTF

that should return the RTF string

I have emailed you the modified FiveMac libs

Re: Getting the texxt of an RichEdit control

Posted: Wed Nov 02, 2016 7:14 pm
by plantenkennis
Hello Antonio,

Thanks for the prompt reply and the new libs. However when I use GetRTF() I get an error:

2016-11-02 20:11:28.191 Plantenkennis[2506:1349742] -[NSConcreteMutableData cStringUsingEncoding:]: unrecognized selector sent to instance 0x7f95b2f0b350
2016-11-02 20:11:28.192 Plantenkennis[2506:1349742] -[NSConcreteMutableData cStringUsingEncoding:]: unrecognized selector sent to instance 0x7f95b2f0b350
2016-11-02 20:11:28.200 Plantenkennis[2506:1349742] (...........

René

Re: Getting the texxt of an RichEdit control

Posted: Thu Nov 03, 2016 9:21 am
by Antonio Linares
Fixed :-)

I have sent you the FiveMac modified libs. Many thanks for your great feedback

Image

Re: Getting the texxt of an RichEdit control

Posted: Thu Nov 03, 2016 7:16 pm
by plantenkennis
Hello Antonio,

Yes perfect, this works just like I wants.
Thanks for the great work. This way we build super apps for OS X

Greetings,

René