Solved

TMemo Limit

Posted on 1997-03-16
1
330 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 50 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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