Getting the texxt of an RichEdit control

Post Reply
User avatar
plantenkennis
Posts: 151
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands
Contact:

Getting the texxt of an RichEdit control

Post 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
 
Kind regards,

René Koot
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Getting the texxt of an RichEdit control

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
plantenkennis
Posts: 151
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands
Contact:

Re: Getting the texxt of an RichEdit control

Post 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é
Kind regards,

René Koot
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Getting the texxt of an RichEdit control

Post by Antonio Linares »

Fixed :-)

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

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
plantenkennis
Posts: 151
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands
Contact:

Re: Getting the texxt of an RichEdit control

Post 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é
Kind regards,

René Koot
Post Reply