TRichViewEdit

General TRichView support forum. Please post your questions here
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

TRichViewEdit

Post by Graham »

I am evaluating this component (and similar from other companies) with the view of using it as the basis of my editor. It needs to work for any language supported by Windows and either Left-to-Right or Right-to-Left text justification.
So far this component is the closest to what I am looking for. However the REditor demo seems to have a problem.
If I set Right to Left justification and select Arabic keyboard language, when I type the caret remains at the right hand side of all the text.

Is this a known issue and can it be fixed? Or is there something I should set to fix the problem?

Graham
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Assign RichViewEdit.BiDiMode = rvbdLeftToRight or rvbdRightToLeft to activate the support of bidirected text.
In addition, BiDiMode can be set for individual paragraphs or text fragments.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Not quite. If I start from your demo program (REditor), I want to be able to achieve the following:

1: Start program and type a line of English text.

2: Press carriage return

3: Select your button for Right To Left text.

4: Select the Arabic keyboard language and type some Arabic

5: At the moment the caret stays on the right hand side of the window.

6: Below is what I have tried with limited success. Using combinations of the various added lines, it changes, but not totally correct. I can get it so that the Arabic is correct, but the previous line of English text changes to be incorrect.

7: Can you modify your Demo program so it works correctly? I will then be able to see what you have done to get a fuller understanding of how to control this edit component.

ParaInfo.Assign(rvs.ParaStyles[StyleNo]);
case UserData of
PARA_ALIGNMENT:
begin
ParaInfo.Alignment := GetAlignmentFromUI;

if ParaInfo.Alignment = rvaLeft then
begin
ParaInfo.BiDiMode := rvbdLeftToRight;
rve.Style.TextStyles[0].BiDiMode := rvbdLeftToRight;
end
else
begin
if ParaInfo.Alignment = rvaRight then
begin
ParaInfo.BiDiMode := rvbdRightToLeft;
rve.Style.TextStyles[0].BiDiMode := rvbdRightToLeft;
end;
end;
end;
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's not a good idea to change BiDiMode in responce to changing alignment. The user may want right-aligned English text or left-aligned Arabic text.
Also, you should not change TextStyles in OnParaStyleConversion.

I created the example:
http://www.trichview.com/forums/viewtopic.php?p=24228
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Thanks for your new demo. I can confirm that changing the TextStyles didn't actually do anything.

Now, your new demo is nearly there, but not quite.

1: Set new button to select Right to Left, select Arabic keyboard and type. Everything is perfect. You can type Arabic and English on the same line and it behaves as you would expect.

2: Start again on a new script, this time set new button to Left To Right text. Type some English and Arabic on the same line and it is OK.

3: Now the problem.

4: Start from a clean script. Type some English text. Press carriage return.

5: Now select the new Right To Left button, select Arabic and start typing. You will see that every time you type a space character, it appears at the start of the line until you type the next character.

6: The same this happens if you type Arabic first and then a line of English. In this case it is the English spaces that are appearing at the start of the line.

7: So the problem appears to be that if you have already typed in some text, it somehow affects subsequent paragraphs if they are of a different BidiMode.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I confirm the problem. We will fix it ASAP. I'll inform you about the results.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I fixed the bug in my internal version (a font caching mechanism ignored changes in paragraph bidimode).
Please test this compiled demo:
http://www.trichview.com/support/files/ ... di_exe.zip
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Looks perfect to me. Does this require a new version of the component or is there a fix for the existing demo.

Graham
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This is a fix in the components themselves, not in the demo.
Currently, this fix is added in my working version. It will be uploaded for registered users in the next week. If you order our component and need this fix sooner, I can send you a patch.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

OK. I will be ordering everything eventually. I am working on a long term project, so as long as I know it has been fixed I am happy. In the past I have always written my own editor. This has the advantage of being able to modify it very easily (add features etc), but the disadvantage of a lot of inital work.

I need to assign attributes to certain lines of text. I am currently investigating "Styles" or "Item Tag" to do this. Is there anything else I should be considering?

And one thing you can answer: If I type some text and save it as an RTF file, when I load it back into the editor I have an extra blank line at the top. Any reason for this?

Also, save as RVF seems to save consistently (Open with NotePad to see the data), But I have created some RVF files that don't open correctly in RichViewEdit. Perhaps only the first line or two are displayed. If I get more clues on this I'll let you know.

Graham
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Which kind of attributes do you want to assign to text?

LoadRTF does not clear the existing document before loading, it adds loaded content to the existing document. Initially, an editor has one empty line of text.
Call Clear before loading (for TSRichViewEdit, call SRichViewEdit.Clear to clear the main editor, header and footer)

Two the most possible reasons for non-opening RVF:
- using images or controls of types not registered with RegisterClasses. TRichView registers TBitmap, TMetafile, TIcon, TJpegImage itself. Other classes (TPngImage, TGifImage) must be registered manually. Call RegisterClasses([TGifImage, TPngImage]) before the first loading.
- saving documents without collections of TextStyles, ParaStyles, ListStyles. Such files can be opened only in editors having compatible collections of TextStyles, ParaStyles, ListStyles.
Make sure that rvfoSaveTextStyles, rvfoSaveParaStyles are included in RichViewEdit.RVFOptions.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Line type are things like special type of headings, instruction lines and types of text that would not normally be read. I have found that I can achieve this by creating my own styles, with each one having a specific font colour and background colour. The downside of this is that the user could accidentally select these colours while typing normal text. Confusion then arises. To avoid this I have assigned the Tag value to the line as well. This is now fine if I save as RVF, but RTF does not save the Tag values. (Unless you know otherwise)

Blank Line now gone on RTF import. I was doing Clear, Format & Update before the load. This cleared the text, but initiated with a blank line.

Missing text. I'll let you know if this happens again.
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can also add your own property to text styles.
This example shows how to add "shadow" property to text:
http://www.trichview.com/forums/viewtopic.php?t=4916 (link to the protected forum for registered users). It can be saved and loaded in RVF and RTF.
Extorian
Posts: 24
Joined: Wed Dec 28, 2011 3:52 pm

Right to left double vowels

Post by Extorian »

Hi Sergey,

I have been begun integrating the component into my project and would soon be purchasing.

During some testing, noted the following bug.

If you select right to left, enter text using the Arabic keyboard and enter any 2 vowels (eg. pressing upper case AA twice) the caret would move to the right side of the line and selection becomes garbled. If I delete the duplicate vowel everything becomes ok. Since it is possible a user may type something like this by mistake it would cause some confusion if the line becomes garbed. Is there a fix for this?

I tested using the REEditing you posted on this thread and the bug is seen in that as well.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

I can confirm this is the case. Can this be fixed in the next release Sergey?
Post Reply