Colors on Editor Widget

ctgivens

New Member
Hello All,

I have some notes that I load into an editor widget. Now I want to change the color of certain words within the editor. Does anyone have an example or an idea of how to accomplish this? I tried to change the color on a fill-in field and replace the text, but it does not retain the color change.

Any help, would be greatly appreaciated
 
The progress editor widget is very basic and I don't think it's possible to change the color of individual words. You may need to look at some comercial OCXs eg TX Text Control, haven't used this myself but it looks like what you need.

ctgivens said:
Hello All,

I have some notes that I load into an editor widget. Now I want to change the color of certain words within the editor. Does anyone have an example or an idea of how to accomplish this? I tried to change the color on a fill-in field and replace the text, but it does not retain the color change.

Any help, would be greatly appreaciated
 
Actually, this is possible but whether you find this workable solution is a different matter.

The 4GL EDITOR widget will respond to Rich Text Format (RTF) commands and with some clever programming, you can display text in a variety of fonts and colours. But note, the 4GL uses a different editor object depending on whether you set the LARGE attribute to true or false. RTF will only work when LARGE = TRUE.

RTF is a comprehensive document formatting language and you can read about it by searching the web.


Here's an example. Most of this is just the header, defining the ansi character set, the font table, and the color table. The only text that is actually displayed in the editor is the sentence "This is plain text". But this has the embedded RTF commands \cf1 (color forground - entry 1 of the color table) and \cf3 (color forground - entry 3 of the color table).

EDITOR-1:SCREEN-VALUE = "~{\rtf\ansi\deff0~{\fonttbl~{\f0\froman Tms Rmn;}~{\f1\fdecor Symbol;}~{\f2\fswiss Helv;}}~{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;} \pard \plain \fs20 \cf2 This is \cf3 plain text.\par}".

The tilde ~ characters before the opening braces { is to stop the 4GL complier interpreting them as include files. They are not part of the RTF language.

I think that this is how colour syntax highlighting is achieved in the procedure and section editors. Perhaps you can think of a way to make this usable in your application.
 
Very nice Mike. It even works of you copy the editor contents to the clipboard and past into Word!

I haven't seen this sort of thing before, can't wait till I find a problem I cant solve with it :)
 
I know the article is quite old. I don't get it working in OpenEdge 12.2.3, it just shows the rtf text instead of a formated text with colors.
Is there any way to achieve this?
 
This was always an unsupported feature. I believe that when Unicode support was added to the client a new editor was used, which doesn't support RTF text. You will need a commercial editor OCX to do this in the progress client.
 
As Simon points out, an unsupported feature and you need to use a commercial option. One option is a .NET solution and I outlined a very simple example here:

 
Back
Top