Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to limit the number of characters per line and the number of lines in a TMem Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
12-Oct-02
Category
Reporting /Printing
Language
Delphi 2.x
Views
116
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Is there a way to place a maximum number of lines in a TMemo?

Answer:
1   
2   procedure TForm1.Memo1Change(Sender: TObject);
3   var
4     i: Integer;
5     s: string;
6   begin
7     i := Length(Memo1.Lines.Text);
8     {Limit the number of lines to 3}
9     if Memo1.Lines.Count > 3 then
10    begin
11      s := Memo1.Lines.Text;
12      Delete(s, i, 1);
13      {Remove line wrap}
14      i := Length(s);
15      while (Ord(s[i]) = 10) or (Ord(s[i]) = 13) do
16      begin
17        Delete(s, i, 1);
18        i := Length(s);
19      end;
20      Memo1.Lines.Text := s;
21      {posistion cursor at end of memo}
22      Memo1.SelStart := Length(s);
23      Memo1.SelLength := 0;
24      ShowMessage('Over Max Lines');
25    end;
26  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC