TRichViewEdit
TRichViewEdit
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
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
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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;
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;
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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
Also, you should not change TextStyles in OnParaStyleConversion.
I created the example:
http://www.trichview.com/forums/viewtopic.php?p=24228
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.
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.
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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
Please test this compiled demo:
http://www.trichview.com/support/files/ ... di_exe.zip
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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
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
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.
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.
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.
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.
Right to left double vowels
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.
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.