1. Home
  2. Computing & Technology
  3. Delphi Programming

How to get the current line and column from a Memo

By , About.com Guide

To get the current line and column from a TMemo component (Memo1) you can use this:

~~~~~~~~~~~~~~~~~~~~~~~~~
var Line, Column : integer;

With Memo1 do begin
   Line := Perform(EM_LINEFROMCHAR,SelStart, 0) ;
   Column := SelStart - Perform(EM_LINEINDEX, Line, 0) ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Controling DLL loading
« How to retrieve control identifiers for all the controls on a common dialog.

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Using VCL Components
  5. TMemo, TRichEdit
  6. How to get the current line and column from a Memo

©2009 About.com, a part of The New York Times Company.

All rights reserved.