richtext
- plantenkennis
- Posts: 151
- Joined: Wed Nov 25, 2015 7:13 pm
- Location: the Netherlands
- Contact:
richtext
I have a memofield with richtext value like this:
{\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
}
Now I want to show this text in a textblock. I use this code:
@ 0, 0 GET oGetAanteken VAR cText MEMO OF oFld:aDialogs[ 3 ] SIZE 680, 350
oGetAanteken:SetRichText(.T.)
oGetAanteken:SetImportGraf(.t.)
oGetAanteken:AddHRuler()
oGetAanteken:SetUndo(.T.)
However, all the RichText code is also shown. How can I make it show only the real text: 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.
{\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
}
Now I want to show this text in a textblock. I use this code:
@ 0, 0 GET oGetAanteken VAR cText MEMO OF oFld:aDialogs[ 3 ] SIZE 680, 350
oGetAanteken:SetRichText(.T.)
oGetAanteken:SetImportGraf(.t.)
oGetAanteken:AddHRuler()
oGetAanteken:SetUndo(.T.)
However, all the RichText code is also shown. How can I make it show only the real text: 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.
Kind regards,
René Koot
René Koot
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: richtext
René,
You have to use FiveMac modified libs that I am emailing you.
This is an example:
You have to use FiveMac modified libs that I am emailing you.
This is an example:
Code: Select all
#include "FiveMac.ch"
function Main()
local oDlg, oFld, oGet, cText := ""
DEFINE DIALOG oDlg SIZE 600, 400
@ 0, 0 FOLDER oFld OF oDlg PAGES "Test" SIZE 600, 350
@ 0, 0 GET oGet VAR cText MEMO OF oFld:aDialogs[ 1 ] SIZE 580, 300
oGet:SetRichText( .T. )
oGet:SetImportGraf( .T. )
oGet:AddHRuler()
oGet:SetUndo( .T. )
oGet:SetFocus()
cText = "{\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}"
oGet:SetAttributedString( cText )
oGet:GoTop()
ACTIVATE DIALOG oDlg CENTERED
return nil
- plantenkennis
- Posts: 151
- Joined: Wed Nov 25, 2015 7:13 pm
- Location: the Netherlands
- Contact:
Re: richtext
Hello Antonio,
Thanks again for the quick reply and the new libs. It has been a long day for me (6.00- 22.00 work), so tomorrow i will test this.
Thanks again for the quick reply and the new libs. It has been a long day for me (6.00- 22.00 work), so tomorrow i will test this.
Kind regards,
René Koot
René Koot
- plantenkennis
- Posts: 151
- Joined: Wed Nov 25, 2015 7:13 pm
- Location: the Netherlands
- Contact:
Re: richtext
Hello Antonio,
It works great if I have one tab or the richedit on the first tab, but if I use more tabs and the richedit is on the third tab I get to see the ruler, but not the buttons with outline ...
Also, is it possible to translate the buttons above the rulers.
And can I set the richedit on readonly
Last, if I use two richedits on two tabs, the program crashes (I need a richedit on the fith tab also.
I don't know how I insert an image in this forum
It works great if I have one tab or the richedit on the first tab, but if I use more tabs and the richedit is on the third tab I get to see the ruler, but not the buttons with outline ...
Also, is it possible to translate the buttons above the rulers.
And can I set the richedit on readonly
Last, if I use two richedits on two tabs, the program crashes (I need a richedit on the fith tab also.
I don't know how I insert an image in this forum
Kind regards,
René Koot
René Koot
- plantenkennis
- Posts: 151
- Joined: Wed Nov 25, 2015 7:13 pm
- Location: the Netherlands
- Contact:
Re: richtext
Kind regards,
René Koot
René Koot
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: richtext
René,
> but if I use more tabs and the richedit is on the third tab I get to see the ruler, but not the buttons with outline ...
You have to do oGet:SetFocus() to each of them. Thats seems to paint it properly
I don't know if we can translate those buttons. We need to google about it
I am going to modify my example to check if it supports several richedits
> but if I use more tabs and the richedit is on the third tab I get to see the ruler, but not the buttons with outline ...
You have to do oGet:SetFocus() to each of them. Thats seems to paint it properly
I don't know if we can translate those buttons. We need to google about it
I am going to modify my example to check if it supports several richedits
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: richtext
René,
Here you have an example with two richedit controls. Notice that I had to increase a little the dimensions of the second one. Not sure why.
testrich.prg
Here you have an example with two richedit controls. Notice that I had to increase a little the dimensions of the second one. Not sure why.
testrich.prg
Code: Select all
#include "FiveMac.ch"
function Main()
local oDlg, oFld, oGet1, cText1 := "", oGet2, cText2 := ""
DEFINE DIALOG oDlg SIZE 600, 400
@ 0, 0 FOLDER oFld OF oDlg PAGES "First", "Second" SIZE 600, 350
@ 0, 0 GET oGet1 VAR cText1 MEMO OF oFld:aDialogs[ 1 ] SIZE 580, 300
oGet1:SetRichText( .T. )
oGet1:SetImportGraf( .T. )
oGet1:AddHRuler()
oGet1:SetUndo( .T. )
oGet1:SetFocus()
cText1 = "{\rtf1\ansi\ansicpg1200\deff0\deflang1043{\fonttbl{\f0\fnil\fcharset0 TIMES NEW ROMAN;}}" + ;
"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs24 FIRST 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}"
oGet1:SetAttributedString( cText1 )
oGet1:GoTop()
@ 0, 0 GET oGet2 VAR cText2 MEMO OF oFld:aDialogs[ 2 ] SIZE 600, 346
oGet2:SetRichText( .T. )
oGet2:SetImportGraf( .T. )
oGet2:AddHRuler()
oGet2:SetUndo( .T. )
oGet2:SetFocus()
cText2 = "{\rtf1\ansi\ansicpg1200\deff0\deflang1043{\fonttbl{\f0\fnil\fcharset0 TIMES NEW ROMAN;}}" + ;
"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\f0\fs24 SECOND 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}"
oGet2:SetAttributedString( cText2 )
oGet2:GoTop()
ACTIVATE DIALOG oDlg CENTERED
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: richtext
René,
Googling for NSRulerView translation did not provided any results so I have posted a tech question in stackoverflow to figure out how to translate the controls texts above the richedit:
http://stackoverflow.com/questions/3682 ... nstextview
Googling for NSRulerView translation did not provided any results so I have posted a tech question in stackoverflow to figure out how to translate the controls texts above the richedit:
http://stackoverflow.com/questions/3682 ... nstextview
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: richtext
René,
I have implemented a new Class TMultiGet method SetEditable( lOnOff )
https://developer.apple.com/library/mac ... index.html
I am emailing you the modified libs
I have implemented a new Class TMultiGet method SetEditable( lOnOff )
https://developer.apple.com/library/mac ... index.html
I am emailing you the modified libs