I have a form with the richviewedit. Document is loading on an initialize function of the form.
After loading the rvf document the form is shown (by calling showmodal) and the focus is set to the rveditor.
The caret should by show at de first character (or at the end) but It look like the caret is painted at the beginning of the second line.
There is some white space between the caret and first character of the second line.
When using the left key the caret is moved to the second character of the first line. So you should see the caret was before the first character but painted too low and too left.
caret at strange position
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
set caret at first position
What's the way to set the caret at the first position or repaint the editor?
I tried this:
with rvEditor.RVData do
SetSelectionBounds(0, GetOffsBeforeItem(0), 0, GetOffsBeforeItem(0));
rvEditor.TopLevelEditor.Invalidate;
I tried this:
with rvEditor.RVData do
SetSelectionBounds(0, GetOffsBeforeItem(0), 0, GetOffsBeforeItem(0));
rvEditor.TopLevelEditor.Invalidate;
small test
In a small test program with the same rvf document is seem to be working correct.
So I will search in our program which function cause this problem
So I will search in our program which function cause this problem
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Yes, your code is correct.
The simpler version is
because after such SelectionBounds, rvEditor.TopLevelEditor=rvEditor.
The simpler version is
Code: Select all
with rvEditor do begin
SetSelectionBounds(0, GetOffsBeforeItem(0), 0, GetOffsBeforeItem(0));
Invalidate;
end;
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
workaround
On the onshow event I implemented this code:
cmbFont.SetFocus; //some other component on the same form
Application.ProcessMessages;
rvEditor.SetFocus;
Application.ProcessMessages;
It's a workaround which works. Reformatting or invalidating didn't work.
cmbFont.SetFocus; //some other component on the same form
Application.ProcessMessages;
rvEditor.SetFocus;
Application.ProcessMessages;
It's a workaround which works. Reformatting or invalidating didn't work.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: