Hello Sergey,
recently you helped me, to jump to a y- position in the memo ("procedure TForm1.Go2memoYpos").
The procedure works correctly.
In the meanwhile, I noticed that the identification of the y-position in a memo with "rve.GetItemCoords" is not correct.
"rve.GetItemCoords" identifies always the 1st line of a multi-paragraph. But I need the correct y-Position.
"OnMouseMoveUp" also doesn't work correct for what I want. If someone needs the y-position in rve, this procedure refers always to the y-position in memo-window (as soon as I scroll, y-Pos is wrong).
Is there a counterpart to "Go2memoYpos"?
Jürgen
procedure TForm1.Go2memoYpos; //---> OK <-----
var RVData:TCustomRVFormattedData;
ItemNo, OffsetInItem: Integer;
begin
rve.GetItemAt(0, rveYpos, RVData, ItemNo, OffsetInItem, False);
RVData := TCustomRVFormattedData(RVData.Edit);
RVData.SetSelectionBounds(ItemNo, OffsetInItem, ItemNo, OffsetInItem);
end;
rve.GetItemCoords identifies 1st line of multline Paragraph
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
uses CRVFData, DLines;
Code: Select all
procedure GetCaretY(rve: TCustomRichViewEdit): Integer;
var DItemNo, DItemOffs, X, Y: Integer;
begin
rve := rve.TopLevelEditor;
rve.RVData.Item2DrawItem(rve.CurItemNo, rve.OffsetInCurItem, DItemNo, DItemOffs);
rve.RVData.GetOriginEx(X, Y);
Result := rve.RVData.DrawItems[DItemNo].Top+Y;
end;
"rve.GetItemCoords identifies 1st line of multline Para
Thanks, Sergey. It seems all oK.
I have deleted my changes because of Sergey answere (look next note).
I have deleted my changes because of Sergey answere (look next note).
Last edited by j&b on Sat May 17, 2008 5:17 pm, edited 1 time in total.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Units DLines and CRVFData must still be added in "uses" of the unit where these functions are defined, otherwise the compiler will report error on lines with .Item2DrawItem and .Top.
There is nothing wrong with using these units, they are already used by trichview code.
Without the line rve := rve.TopLevelEditor, your code will not work when the caret is inside table cell (the table's Y coordinate will be returned instead of the caret's Y). Of course, rve must be local to this function (parameter), so assignment to it will not change a global rve.
There is nothing wrong with using these units, they are already used by trichview code.
Without the line rve := rve.TopLevelEditor, your code will not work when the caret is inside table cell (the table's Y coordinate will be returned instead of the caret's Y). Of course, rve must be local to this function (parameter), so assignment to it will not change a global rve.