How to code in Delphi superscript etc

General TRichView support forum. Please post your questions here
Post Reply
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

How to code in Delphi superscript etc

Post by larshgf »

Hello,

I want trichview component placed at the bottom of my form. While a user is putting data into some editfields the exit eventhandler calls a procedure coding for rtf-text in this trichview.
Could you give me an example of how to code into trichviw the attached text Delphi.
Dokument.jpg
Dokument.jpg (16.96 KiB) Viewed 31581 times
I presume that when saving this text as RTF the superscrip will persist?

/Lars - DK
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to code in Delphi superscript etc

Post by Sergey Tkachenko »

Do you want an example how to generate such document in code?

Yes, sub/superscripts are stored in RTF
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

Do you want an example how to generate such document in code?
Yes - thank you

And the reason is that this is in fact all I need in my lexicographical program.
I dont need a wordpad-like editor, i just need to be able to show the user what the database input will look like in the final dictionary output. So while the input is done in the editfields the exit-event of each of these editfields calls a procedure which code the dictionary layout in a TRichView placed at the bottom of the screen.
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to code in Delphi superscript etc

Post by Sergey Tkachenko »

A sample project creating this document in code is attached.
Attachments
MakeSampleDoc.zip
(2.9 KiB) Downloaded 1312 times
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

Thank you, I have downloaded the code. Installed the TRichView trialversion. Then tried to run the program.
First I get an "access violation" error. After having canceled this error the form pups up and in the bottom TrichView area I get this message:

Style is not defined.
Create a TRVStyle object and assign it to RichView1.Style


Can you tell me what is the problem here?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to code in Delphi superscript etc

Post by Sergey Tkachenko »

Which Delphi version do you use?
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

XE 10.1 Berlin
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to code in Delphi superscript etc

Post by Sergey Tkachenko »

I downloaded the trial version from our website, installed it in Delphi 10.1, and this demo runs fine on my computer. So I cannot reproduce the problem.
The demo really will raise an exception if TRVStyle component is not assigned to Style property of RichviewEdit1. Please check that it is assigned, in the Object Inspector.
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

I downloaded the sample once more, and now it is working fine. Thank you!
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

In the same manner (as the above attached demo) I would like to code for font and size in Delphi.
I was told in another thread that this could be found in Editor2 demo. Do you have a link to this folder please? Thank you!

PS: function GetTextStyle(Style: TFontStyles; Color: TColor;
SScript: TRVSubSuperScriptType): Integer;

- here you have color and style
- where do you have font and size?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to code in Delphi superscript etc

Post by Sergey Tkachenko »

I attached a modified demo.
In this demo, GetTextStyle has additional parameter, SizeDouble (double font size in points). For example, SizeDouble = 20 means font size 10pt, SizeDouble=21 means font size 10.5pt.
Internally, the function simply assigns this parameter to the property of the same name of TextStyle object.
You can see text properties in the help file, may be you will need to define even more properties: http://www.trichview.com/help/pme_cp_tfontinfo.html
You can simply add the corresponding parameter to GetTextStyle and assign it to the property in this function.
Attachments
MakeSampleDoc2.zip
(6.33 KiB) Downloaded 1125 times
larshgf
Posts: 20
Joined: Fri Jan 20, 2017 9:35 am

Re: How to code in Delphi superscript etc

Post by larshgf »

Thank you Sergey - just what I needed.
Post Reply