FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour richedit class
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM

richedit class

Posted: Mon Nov 10, 2008 04:23 PM

Hi all,

i'd like to use the richedit class and have some questions about it.

Tables:
Does the FiveWin class support creation and/or reading of tables?

Color of Text:
Does the FiveWin class support background colors for text?

Thanks for your answers.

Regards,
Detlef

Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM

richedit class

Posted: Mon Nov 10, 2008 07:56 PM

Though I haven't used TRichedit yet, by looking at \fwh\source\classes\TRichedi.prg it seems that the following info appears to be relevant...

The class has seven methods dealing with loading and saving data, GetSel(), LoadRTF(), LoadAs RTF(), LoadFromRTFFile(), SetText(), and SaveAsRTF(), SaveToFile() that should be looked at closely. They seem to offer a variety of ways to get and save the RTF data.

Some of these seem to work similarly to MEMOREAD() and MEMOWRIT() used with memo text. It looks as though LoadFromRTFFile() enables loading from a database with RTF data in a memofield.

Insofar as TRichedit inherits from TControl which in turn inherits from TWindow, the provisions for handling foreground and background colors in those parent classes are inherited here.

  • Roger
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM

richedit class

Posted: Mon Nov 10, 2008 10:39 PM

Roger,

thanks for jumpin' in.
My understanding of RichText was similar to a mark up language as html.

So i tried to color a text with tags like \fc1\bc2 where '1' and '2' are indizes for the color table.
I succeeded to change the foreground color of a dstreing with \fc+'x'.
But when i try to set a background color with \bc+'x' i didn't succeed.

I ask myself if this is a limitation of the FiveWin RTF class or if it's a misunderstanding of me?

Regards,
Detlef

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

richedit class

Posted: Mon Nov 10, 2008 11:20 PM
Detlef,

I think you have the codes backwards, it is cf and cb.

{\f1\cb1\cf2 This is colored text. The background is color 1 and the foreground is color 2.}


http://www.biblioscape.com/rtf15_spec.htm#Heading16

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM

richedit class

Posted: Tue Nov 11, 2008 08:38 AM

Thank you, James,

but exchanging \fc and \bc doesn't make any difference.
You will see that your sample does not change the background color.

I think it's a MS related bug because MS Word and MS WordPad can't display an other background color as white neither.

Regards,
Detlef

Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

Re: richedit class

Posted: Tue Nov 11, 2008 09:04 AM
Detlef,

Detlef Hoefner wrote:
Color of Text:
Does the FiveWin class support background colors for text?


assuming that oRTF is your Richedit object, you can use
oRTF:SetTextColor( ChooseColor() )
to change the textcolor of the selected text and
oRTF:SetHighlight(ChooseColor(oRTF:GetHighlight())
to change the background color of the selected text
kind regards

Stefan
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM

richedit class

Posted: Tue Nov 11, 2008 11:38 AM

Stefan,

thanks a lot for your help.
The background color is setting up fine now.

It seems that tag \cb is never used because the bg-color is done with the tag \highlight + n.

Thanks again,
Detlef

Continue the discussion