Solved

Longer Labels or Memo ?

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 63
control image tags in a string ? 12 153
Dev express lookupcombo 3 46
Firemonkey DbLookupComboBox equivalent ? 2 68
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…
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…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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