开发者

Delphi - Memo Right Click Get Line Number

开发者 https://www.devze.com 2022-12-27 00:08 出处:网络
How do I get the line number of a memo when I right click on it? A ListBox has .It开发者_StackOverflow中文版emAtPos but I\'ve not been able to find a similar function

How do I get the line number of a memo when I right click on it?

A ListBox has .It开发者_StackOverflow中文版emAtPos but I've not been able to find a similar function

-Brad


In Delphi 2010, TRichEdit has an ActiveLineNo property. Not sure if it exists in Delphi 2009.

The manual way to get the line number is to send the Memo an EM_LINEFROMCHAR message with the WParam value set to -1, ie:

LineNo := SendMessage(Memo1.Handle, EM_LINEFROMCHAR, -1, 0);

Or:

LineNo := Memo1.Perform(EM_LINEFROMCHAR, -1, 0);


Check CaretPos property.

0

精彩评论

暂无评论...
验证码 换一张
取 消