?
Solved

TMemo Limit

Posted on 1997-03-16
1
Medium Priority
?
333 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
[X]
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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
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…
Suggested Courses

719 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