?
Solved

How determine cursor position in TMemo component?

Posted on 1997-09-30
1
Medium Priority
?
456 Views
Last Modified: 2010-05-18
Hi!

This question seems so darn easy, but I haven't been able to figure it out yet.
Question: How do I determine the row and column-position of the cursor in an active TMemo component? The only thing I've found is SELSTART, which tells me how many characters into the document the cursor is positioned. But what about row and column??
   I've solved the problem myself by counting how many #13-characters there is from the start of the memos text until the SelStart-value, but when the cursor reaches line 15 or so it begins to slow down program execution. (I wrote it in Pascal... haven't been assemling much lately). Maybe the same routine in inline-assembler would be acceptably fast. The routine has to be able to manage memos up to 500 rows long without putting suryp in the system, though.

Thanks!

//Daniel, Sweden
0
Comment
Question by:Dippen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
erajoj earned 300 total points
ID: 1346635
Hej Daniel!
It's not hard to accomplish if you are acquainted with
some of the messages that the TEdit responds to:

  with Memo1 do begin
    Row := SendMessage(Handle, EM_LINEFROMCHAR, -1, 0);
    Col := SelStart-SendMessage(Handle, EM_LINEINDEX, -1, 0);
  end;

/// John, also Sweden

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question