Solved

Top visible line in a RichEdit

Posted on 2001-07-29
3
202 Views
Last Modified: 2013-11-22
Hi!
Can anybody tell me how I can receive the number of the line that is displayed on the top of a RichEdit component. I would also be satisfied with getting the character position (like StartSel does) of this first line, because all the lines have identical length, and so it would only require a simple division.
Regards, Hamilton.
0
Comment
Question by:Hamilton
3 Comments
 
LVL 21

Expert Comment

by:gemarti
ID: 6331332
If you are going to be clicking on the position at the top of the richedit control you can use this code to get the line number:

var
  Point : TPoint;
begin
  Point := RichEdit1.CaretPos;
  ShowMessage(IntToStr(Point.X)+ ' ' +IntToStr(Point.Y));
end;
0
 
LVL 5

Accepted Solution

by:
alanwhincup earned 100 total points
ID: 6331377
Try this:

procedure TForm1.Button1Click(Sender: TObject);
var
  VisibleLine : Integer;
begin
  VisibleLine := RichEdit1.Perform(EM_GETFIRSTVISIBLELINE, 0 , 0);
  ShowMessage(IntToStr(VisibleLine));
end;
0
 

Author Comment

by:Hamilton
ID: 6332384
Your code example is working very well! Thank you! :-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now