We help IT Professionals succeed at work.

Multiple lines on a button

ble
ble asked
on
Medium Priority
225 Views
Last Modified: 2010-04-04
When I want to use multiple lines on a TLabel object, I can use: Caption := 'Line1'+#13+'Line2'.
If I want to do the same for a TButton object this will not work. It gives a text on one line with an character in the text instead a carriage-return. How do I get two lines of text on a button?
Comment
Watch Question

Commented:
You must in CreateParams for button make this line
Params.Style:=Params.Style or ES_MULTILINE;

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
ble

Author

Commented:
I suppose this is not available in Delphi 1.0? (I forgot to tell that I'm using that version.)
ble

Author

Commented:
I found that it is also in Delphi 1.0, but can you give me an example on how to use this?

Commented:
Example of descendant of TButton

TLineButton=class(TButton)
 protected
  Procedure CreateParams(var Params:TCreateParams);override;
 public
  ....
end;

procedure TLineButton.CreateParams(var ...);
begin
 inherited CreateParams(Params);
 Params.Style:=Params.Style or BS_MULTILINE;
end;

procedure Register;
.........
after register try this
ble

Author

Commented:
Thanks, clear example, but... BS_MULTILINE is not available on Delphi 1.0, and ES_MULTILINE as you suggested in your first response doesn't work (is indeed not for TButton but for TEdit).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.