richedit class

richedit class

Postby Detlef Hoefner » Mon Nov 10, 2008 4: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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Roger Seiler » Mon Nov 10, 2008 7: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
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Detlef Hoefner » 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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Mon Nov 10, 2008 11:20 pm

Detlef,

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

Code: Select all  Expand view
{\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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Tue Nov 11, 2008 8: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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: richedit class

Postby StefanHaupt » Tue Nov 11, 2008 9: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
Code: Select all  Expand view
oRTF:SetTextColor( ChooseColor() )
to change the textcolor of the selected text and
Code: Select all  Expand view
oRTF:SetHighlight(ChooseColor(oRTF:GetHighlight())
to change the background color of the selected text
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Detlef Hoefner » 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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests