Forum > General

How can I place a label in front of a button without overlapping it?

(1/3) > >>

Galmer:
Hello!

I only recently started using Lazarus, so I don’t know many of the nuances. I created TBitBtn and I need to place a label “on top” of it. If this is implemented directly, then the label intercepts button events and the button does not react to anything.

I have two options. Either somehow disable the label’s response to events, or somehow “throw” these events onto the button located under it.

I would be grateful for any help. Today I spent the whole day trying to understand how TVirtualStringTree works, my head is already hard to think)

P.S. The Caption property is not suitable here because it only places text on the side of the image.

ASerge:
Replace TLabel with TStaticText. It can.

Galmer:

--- Quote from: ASerge on March 31, 2024, 10:22:14 pm ---Replace TLabel with TStaticText. It can.

--- End quote ---

Thanks for the advice, but it didn't help. Static text, intercepts mouse events just like a label.

wp:
Why don't you use the Caption property of the TBitBtn? You write "The Caption property is not suitable here because it only places text on the side of the image." So, you want to have the Caption above/below the image? Use the button's Layout property for this. Further parameters for affecting the text position are Margin (distance between image and border) and Spacing (distance between text and caption). -1 means in both cases: "automatic selection of value". Or you do not want to display an image at all? Leave the Glyph property empty (or ImageIndex at -1) in this case.

Galmer:

--- Quote from: wp on April 01, 2024, 11:34:44 am ---
--- End quote ---
Hello!

I use the TBitBtn properties - ImageIndex, HotImageIndex and PressImageIndex to set my textures for these events. But at the same time, I need the inscription to be placed in the center of the button. I have attached a picture, there is a button with the inscription "AAC, 64 kbps".

The Caption and Layout properties are not suitable here, because I need to place the caption not on the side, but above the button - on top of it.

Navigation

[0] Message Index

[#] Next page

Go to full version