Board index » delphi » TButton.Caption - word wrap?

TButton.Caption - word wrap?

Is it possible to word wrap a caption for a button?

-------------------------------------------------------------------
Russell England
Contract Software Services Ltd
http://www.css2.com  
-------------------------------------------------------------------

 

Re:TButton.Caption - word wrap?


I don't know that it's possible, but if no one else can come up with a
method, then
you may want to consider a Panel with a word-wrapped, non-autosized label on
it.

You will probably need to point the panel.onclick and the label.onclick to
the same event,
so that the user doesn't have to differentiate whether to click on the label
or the panel.

As an added nicety, set up the mouseDown and mouseup events on the panel to
change
the bevel settings for that "button depressed" look. Point the label MouseUp
and MouseDown
to the same events.

Good Luck!

 -Aldis

Quote
Russell England wrote in message <355C16E7.81C2A...@css2.com>...
>Is it possible to word wrap a caption for a button?

>-------------------------------------------------------------------
>Russell England
>Contract Software Services Ltd
>http://www.css2.com
>-------------------------------------------------------------------

Re:TButton.Caption - word wrap?


Quote
Russell England wrote:
> Is it possible to word wrap a caption for a button?

I think so, set FWordWrap how you want, and then try this in your
TButton descendant:

procedure TMyButton.CreateParams(var Params: TCreateParams); //override
begin
  inherited;
  with Params do
    if FWordWrap then Style := Style or BS_MULTILINE;
end;

Erik

Re:TButton.Caption - word wrap?


Quote
In article <355C16E7.81C2A...@css2.com>, Russell England wrote:
> Is it possible to word wrap a caption for a button?

Russell,

on Win95 and NT 4.0 a standard button control can have the style
BS_MULTILINE (see CreateWindow in win32.hlp). Delphi's TButton does not
support that, so you would have to create a descendent of TButton, give it
a boolean multiline property, override the CreateParams method and OR the
BS_MULTILINE style into Params.Style (after calling the inherited method)
if the property is True.

There is a 100% chance that somebody has already done that and published
the component, go search on one of the sites below:

Delphi Super Page       http://sunsite.icm.edu.pl/delphi/
  US mirror site:       http://www.cdrom.com/pub/delphi_www/
Torry's Delphi Pages    http://www.torry.ru/  
The Delphi EXchange     http://www.delphiexchange.com/
The DELPHI Deli         http://www.delphideli.com/
Delphi forum lib mirror: ftp://ftp.dbdinc.com, pub/delphi, pub/delphi32

Peter Below (TeamB)  100113.1...@compuserve.com)

Other Threads