Solved

Longer Labels or Memo ?

Posted on 1998-03-25
5
144 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
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 50 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

829 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