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
Solved

Top visible line in a RichEdit

Posted on 2001-07-29
3
205 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 56
Delphi: ForceDirectory plain function 7 42
SUM 2 INTEGER ARRAYS INTO 1 10 108
Delphi android app hide keyboard 3 16
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 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