Getting the texxt of an RichEdit control

Getting the texxt of an RichEdit control

Postby plantenkennis » 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: Select all  Expand view


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
plantenkennis
 
Posts: 70
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: Getting the texxt of an RichEdit control

Postby Antonio Linares » Wed Nov 02, 2016 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 35346
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Getting the texxt of an RichEdit control

Postby plantenkennis » Wed Nov 02, 2016 7: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
plantenkennis
 
Posts: 70
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: Getting the texxt of an RichEdit control

Postby Antonio Linares » Thu Nov 03, 2016 9:21 am

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
Antonio Linares
Site Admin
 
Posts: 35346
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Getting the texxt of an RichEdit control

Postby plantenkennis » Thu Nov 03, 2016 7: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
plantenkennis
 
Posts: 70
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands


Return to FiveMac / FivePhone (iPhone, iPad)

Who is online

Users browsing this forum: No registered users and 1 guest