I need to remove a button focus rectangle, because it looks bad over the TBitBtn
glyph after the buttons is clicked.
To remove focus around the button outline:none property is used. Outline property: Outline is an element property which draws a line around element but outside the border.
To remove or disable focus border of browser with CSS, we select the styles for the :focus pseudo-class. to set the outline style to none to remove the border of the element that's in focus.
You can create an Interposer class for TBitBtn
and override SetButtonStyle
preventing it's internal IsFocused
variable to be set:
type
TBitBtn = class(Buttons.TBitBtn)
protected
procedure SetButtonStyle(ADefault: Boolean); override;
end;
...
implementation
procedure TBitBtn.SetButtonStyle(ADefault: Boolean);
begin
inherited SetButtonStyle(False);
end;
This will result a TBitBtn
with no focus rectangle. (Tested with D7 - with/without Theme support).
As a workaround, you can use a TSpeedButton
, which does not take the focus and, consequently, never receives a focus rectangle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With