How To Get Cursor Location or Active Line From a TMemo lazarus / 31-LCL ---------------------------------------------------------------------- MrBill · 2012-12-17 23:08 Hi, Just started with Lazarus/FPC and it's awesome!  I'm developing a little utility to help a user examine log files.  The process has steps: 1.  User selects file, program imports file into a TStringList, works fine. 2.  User enters some filtering criteria after which filtered data from the TStringList is put into a TMemo and pointers to original line numbers are stored away, works fine 3.  User right clicks on a line, to get popup menu, works fine. 4.  User selects popup menu option that brings up a new window showing the 10 lines from the original file (in the TStringList) located just before the line on which he did the rt mouse button click. My problem is that I can't figure out how to get either the cursor location in the TMemo or the TMemo line number on which the operator did the right mouse button click.  If I knew where he clicked, I could trace back to the original data and grab the relevant lines. Any suggestions? Thanks, Bill ---------------------------------------------------------------------- MrBill · 2012-12-17 23:30 Update:  I found that I can use SelStart method on the TMemo object.  This returns the location in the TMemo.  From this, I can work back to the line number in the original file. But is there an easier way? My TMemo is named Memo1.  It sure would be nice if I could do something like: selectedLine = Memo1.Lines.SelectedLine; But I don't see anything like this.  Am I missing something? Thanks, Bill ---------------------------------------------------------------------- Blaazen · 2012-12-17 23:43 Maybe you should try TSynMemo instead of TMemo. It has properties/methods: LineText, CaretX, CaretY, CaretXpix, CaretYpix, PixelsToRowColumn, PixelsToLogicalPos which should do all you need. ---------------------------------------------------------------------- MrBill · 2012-12-18 15:37 Wow, that class has a lot of stuff I need.  I'll put it to use immediately. Thanks, Bill ---------------------------------------------------------------------- Martin_fr · 2012-12-18 15:48 SynEdit is the component used as editor in Lazarus. It also has a lot of highlight stuff, that may interest you. Like highlighting al occurrences of a word, phrase, or just combination of letters. Code: [Select]  SynEdit.SetHighlightSearch(...) If you subclass (see ide/SourceSynEditor for example), you can add several of this markup, and highlight more than one at the same time. Also for fine tuning Code: [Select]TSynEditMarkupHighlightAll(SynEdit.MarkupByClass[TSynEdi tMarkupHighlightAll]) ---------------------------------------------------------------------- MrBill · 2012-12-20 04:13 Ah, yes.  I was wondering how to do the word highlighting.  I will give it a shot. After I get the basics of my app working, I'll look into the sub- classing. Thanks, Bill