Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a button multiline / with word wrap? 2

Status
Not open for further replies.

awarnica

Programmer
Jan 16, 2003
78
CA
Pretty simple I hope, I have a few TButtons on my form, I need to have the caption be multiline or be able to word wrap the caption.

Due to size constraints on my screen I cannot resize the buttons to take the full caption.

Any help is appreciated!

Andrew
 
Click on the Tbutton, then navigate to the properties tab of the object inspector window. Scroll to the bottom and change the Wordwrap option to true, then resize your tbutton appropriately.
 
Mine does! Derived from TButtonControl. I am using Delphi 7 - which are you using?
 
The only way I can think of, is to use a BitBtn and then sets its caption in code. i.e

BitBtn1.Caption := 'Hello' + #13 + 'World';

Then the caption would display 'Hello World' over two lines in the bitbtn. Of course, doing it this way means you would need to line everything up yourself... Arte Et Labore
 
I'm way back in Delphi 5.

Ill give the bitbtn a shot.
 
Thanks EricDraven, this works for me.

Odd that it doesnt work with a regular button but does with a BitButton -> But it works, I put the code onthe FormShow event.

Thanks again, this will make my life simpler!

Andrew
 
Andrew,

By default, tButton doesn't surface a WordWrap property, though it certain contains underlying support for one. You can create a tWrapButton descendant that surfaces this within a few minutes.

There's a walkthrough available at it's simple, but shows the basic process.

There are other ways you can do this.

Hope this helps...

-- Lance
 
Thanks Lance, I like that one - it is now a part of my Standard pallette, in less than 5 minutes.

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top