Page 1 of 1
How to code in Delphi superscript etc
Posted: Mon Feb 06, 2017 11:40 am
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 (16.96 KiB) Viewed 35631 times
I presume that when saving this text as RTF the superscrip will persist?
/Lars - DK
Re: How to code in Delphi superscript etc
Posted: Mon Feb 06, 2017 1:14 pm
by Sergey Tkachenko
Do you want an example how to generate such document in code?
Yes, sub/superscripts are stored in RTF
Re: How to code in Delphi superscript etc
Posted: Mon Feb 06, 2017 9:52 pm
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.
Re: How to code in Delphi superscript etc
Posted: Wed Feb 08, 2017 1:53 pm
by Sergey Tkachenko
A sample project creating this document in code is attached.
Re: How to code in Delphi superscript etc
Posted: Thu Feb 09, 2017 3:15 pm
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?
Re: How to code in Delphi superscript etc
Posted: Thu Feb 09, 2017 6:05 pm
by Sergey Tkachenko
Which Delphi version do you use?
Re: How to code in Delphi superscript etc
Posted: Thu Feb 09, 2017 9:07 pm
by larshgf
XE 10.1 Berlin
Re: How to code in Delphi superscript etc
Posted: Fri Feb 10, 2017 7:11 am
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.
Re: How to code in Delphi superscript etc
Posted: Sun Feb 12, 2017 6:11 am
by larshgf
I downloaded the sample once more, and now it is working fine. Thank you!
Re: How to code in Delphi superscript etc
Posted: Tue Feb 21, 2017 12:12 am
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?
Re: How to code in Delphi superscript etc
Posted: Tue Feb 21, 2017 6:48 am
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.
Re: How to code in Delphi superscript etc
Posted: Wed Feb 22, 2017 9:20 am
by larshgf
Thank you Sergey - just what I needed.