Link to home
Start Free TrialLog in
Avatar of gljsentvid16
gljsentvid16

asked on

TSpeedButton

Is it possible to align text in TSpeedButton (.Caption) to the most left or right?
Avatar of 333
333

Hi,
I'm not sure, that it's what you need, but...

Try to change TSpeedButton.Layout to blGlyphLeft or blGlyphRight and set TSpeedButton.Margin to i.e 1. If TSpeedButton.Margin=-1 (default), Text and Glyph are centered horizontaly and verticaly. When you change Margin to 1, then Text and Glyph are aligned depending on TSpeedButton.Layout.

A.
Avatar of gljsentvid16

ASKER

Hi!

 Nope, this just specifies, how the glyph and text are oriented. What I would like is to set the caption of the button to the most left or right corner of the button (like in Text editors such as MSWord where you can set align).

M.
try it with TSpeedButton.layout:=[blGlyphRight] or [blGlyphLeft]

regards
rene
Can't you make glyph, that covers whole button?

A.
Basically, you could play with it, like putting a button without text, and putting a label on it. SpeedButton has no defined way to do exactly what you want, though it's not hard to change it's sources at all. Also if you use the normal TButton instead, I bet you have a way to do this.
Hi!

  .layout[] will not do. If I wanted to create glyph, I would have to create .bmp image (from .caption), and glue it on - naah, too much to do. Putting label on it covers OnClick event, so this one won't do either. And yes, I need to use TSpeedButton, cos TButton is not .Flat and .Down . If you know how to change sources please, tell me :-).

   M.
OK, I'll look and try to change them. Do you use bitmaps with your buttons? Because it's VERY simple if you don't use glyphs, otherwise it'll be harder.

Menwhile, you can try: put a label on the button, and in the label's OnMouseDown, OnMouseUp, OnMouseMove, send the same messages to the button beneath. Not MouseDown, MouseUp methods, but messages with SendMesages: WM_LBUTTONDOWN, WM_LBUTTONUP.

--Matvey
Matvey, I don't use glyphs so I'm glad it's easy :-)

M.
ASKER CERTIFIED SOLUTION
Avatar of Matvey
Matvey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial