Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Longer Labels or Memo ?

Posted on 1998-03-25
5
Medium Priority
?
147 Views
Last Modified: 2010-04-06
Which component shoul I use to display text (more than 255 chars which is the limit of either Label ans StaticText) ? I don't want this text to be editable I just want ot display it. If I use TMemo when I disable it so that no user can edit it becomes dimmed. Can I change this ?
0
Comment
Question by:aloha
[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
5 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1360859
Hi,

1 - Take a TMemo
2 - Set BorderStyle to bsNone
3 - Set Color to clBtnFace
4 - Set Ctl3D to false
5 - Set ReadOnly to true
6 - DO NOTt set Enabled to FALSE

may this help
Igor
0
 

Author Comment

by:aloha
ID: 1360860
But that still makes the cursor appear and the text is selectable. I don't what this to happen too.

And How do I assign some text to the Memo in code not in the object inspector? If I use the Text property I cant Assign strings longer than 255 chars. How do I use the Lines property ?

Sorry for not mentioning it earlier.
0
 
LVL 5

Expert Comment

by:inter
ID: 1360861
Here is for adding text line by line:

Memo1.Lines.Add('this is line 1');
Memo1.Lines.Add('this is line 2');

etc,

Regards,(no disable code sorry)
Igor
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1360862
Put the readonly property to true

JDB
0
 
LVL 2

Accepted Solution

by:
rene100 earned 200 total points
ID: 1360863
Hi aloha
this is the code for a new memo component that should solve your problem:

unit Memo1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TMemo1 = class(TMemo)
  private
    procedure WMLClick(var message: TMessage); message  WM_LButtonDown;
    procedure WMRClick(var message: TMessage); message WM_RButtonDown;
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Eigene', [TMemo1]);
end;

procedure TMemo1.WMLClick(var message: TMessage);
//dispatch left-mouseclicks
begin
end;
procedure TMemo1.WMRClick(var message: TMessage);
//dispatch right-mouseclicks
begin
end;
end.

additionly, you must set the read-only property to true, the
tabstop property to false and the cursor property to crArrow
(if you don't want to do these things everytime, use
TMemo1=class(TCustomMemo) in spite of TMemo1=class(TMemo) and
publish all properties you need).

hope this help and I didn't forgot something

regards
rene100
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 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