cursor is hidden after using rve.scrollTo

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

cursor is hidden after using rve.scrollTo

Post by j&b »

Hello,

caret is not shown after pressing "pGoToLineClick".

Background:
if have selected a memo-line and put it's y-pos into a variable named "rveYpos" (pMarkYposClick).
Now I scroll in memo and after a time I want to go back to the position of "rveYpos" (pGoToPosClick).

All runs fine. Only caret (Schreibmarke) is hidden.
What's to do to show caret ?

After clicking into memo caret appears (where mouse-cursor hit memo).

Jürgen



Private
rveYpos: integer;
...


procedure TForm1.pMarkYposClick(Sender: TObject);
var x: integer;
begin
rve.GetItemCoords(rve.CurItemNo,x,rveYpos);
end;

procedure TForm1.pGoToPosClick(Sender: TObject);
begin
rve.scrollTo(rveYpos);
//rve.Reformat;
rve.setfocus; //caret doesn't appear
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

ScrollTo just scrolls the editor's window to the specified scrollbar position.
The caret is still in the same location as before, and if this is location becomes invisible, the caret becomes invisible too.

You need to deside what do you want to change - the caret location of vertical position.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:ScrollTo just scrolls the editor's window to the specified scrollbar position.
The caret is still in the same location as before, and if this is location becomes invisible, the caret becomes invisible too.

You need to deside what do you want to change - the caret location of vertical position.
Thanks.

I can jump to each line (problem font.size or number of lines of a paragraph), but not to the line near a wanted memo-y-position)

I have a database rve-memo and have to write a topic always to the same place of each memo (perhaps I change font.size or number of lines of a paragraph or I change memo and have to write a topic at the same position ... .


"rve.GetItemCoords(rve.CurItemNo,x,rveYpos)" tells me y-position of wanted place (for a topic)
By clicking a button I jump to "rveYpos" whether font.size or number of lines of a paragraph have changed in meantime.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want to move caret to the specified Y position?

Code: Select all

var RVData:TCustomRVFormattedData;
  ItemNo, OffsetInItem: Integer;

rv.GetItemAt(0, Y, RVData, ItemNo, OffsetInItem, False);
RVData := TCustomRVFormattedData(RVData.Edit);
RVData.SetSelectionBounds(ItemNo, OffsetInItem, ItemNo, OffsetInItem);
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Sergey Tkachenko wrote:Do you want to move caret to the specified Y position?

Code: Select all

var RVData:TCustomRVFormattedData;
  ItemNo, OffsetInItem: Integer;

rv.GetItemAt(0, Y, RVData, ItemNo, OffsetInItem, False);
RVData := TCustomRVFormattedData(RVData.Edit);
RVData.SetSelectionBounds(ItemNo, OffsetInItem, ItemNo, OffsetInItem);
Thanks. That is it.
For these few lines I try many hours ....
Post Reply