Solved

Longer Labels or Memo ?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now