Page 1 of 1

cursor is hidden after using rve.scrollTo

Posted: Tue May 13, 2008 11:14 am
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;

Posted: Tue May 13, 2008 2:39 pm
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.

Posted: Tue May 13, 2008 3:11 pm
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.

Posted: Tue May 13, 2008 3:28 pm
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);

Posted: Tue May 13, 2008 3:35 pm
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 ....