FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveMac / FivePhone (iPhone, iPad) Getting the texxt of an RichEdit control
Posts: 166
Joined: Wed Nov 25, 2015 07:13 PM
Getting the texxt of an RichEdit control
Posted: Tue Nov 01, 2016 10:29 PM
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 (fw): Select all Collapse
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Getting the texxt of an RichEdit control
Posted: Wed Nov 02, 2016 04:31 PM

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
Posts: 166
Joined: Wed Nov 25, 2015 07:13 PM
Re: Getting the texxt of an RichEdit control
Posted: Wed Nov 02, 2016 07:14 PM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Getting the texxt of an RichEdit control
Posted: Thu Nov 03, 2016 09:21 AM
Fixed :-)

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 166
Joined: Wed Nov 25, 2015 07:13 PM
Re: Getting the texxt of an RichEdit control
Posted: Thu Nov 03, 2016 07:16 PM

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

Continue the discussion