Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TMemo Limit

Posted on 1997-03-16
1
Medium Priority
?
338 Views
Last Modified: 2010-04-04
I want to limit a TMemo window to 100 lines.
If a 101st line is added, delete the 1st Line
so that always only the last 100 Lines are there.
Please e-mail me with response
Lechtor@kalamazoo.net
0
Comment
Question by:lechtor
1 Comment
 
LVL 3

Accepted Solution

by:
mheacock earned 100 total points
ID: 1334767
Is the text coming from user input or from a file?

Use a combination of the following TMemo methods and
properties to achieve what you want:

    create a variable that will keep track of the number of lines.
    use the OnKeyPress event to capture the use of the ENTER key, increment the NumLines variable each time.
    check NumLines after each ENTER keypress, if it is >100,
use the DELETE method to delete the first line in the TMemo, decrement the NumLines by one.

If you are reading from a file, it is trivial to keep track of the number of lines entered into the TMemo yourself.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

783 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