0

I have a Tmemo component that can display 10 rows with the current font. There are currently 5 rows assigned, i,e Memo.lines.count -1 = 4. Is there a way to detect when a row is clicked that is greater than the last assigned/displayed row. Example: If I click it the area of row 7, the function returns the last row assigned or row 4. I am looking for feedback that tells me that I am clicking a non-assigned area.

The code below identifies existing rows clicked. Could there be info in it I am missing?

Thank you for reading.

Vern

from About.com
function SelectMemoLine(Memo : TCustomMemo):integer ;
var
Line : integer;
begin
with Memo do
begin
Line := Perform(EM_LINEFROMCHAR, SelStart, 0) ;
SelStart := Perform(EM_LINEINDEX, Line, 0) ;
SelLength := Length(Lines[Line]) ;
result := Line;
end;
end;

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by jsosnowski
0

This might help:
The property CaretPos will tell you which line the cursor has selected. (CaretPos.y) I have not tested it to see if it will point to a line beyond the end of the text or not. The number of lines in the Tmemo should be in the "lines" property index. This might help:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.