How can I hide the focus around a VCL TTrackBar when selected/while tracking, while using a VCL style? Using Delphi 11.1
This didn't work:
SendMessage(tb1.Handle, WM_UPDATEUISTATE, UIS_SET OR UISF_HIDEFOCUS, 0);
How can I hide the focus around a VCL TTrackBar when selected/while tracking, while using a VCL style? Using Delphi 11.1
This didn't work:
SendMessage(tb1.Handle, WM_UPDATEUISTATE, UIS_SET OR UISF_HIDEFOCUS, 0);
Using
SendMessage(tb1.Handle, WM_UPDATEUISTATE, UIS_CLEAR OR UISF_HIDEFOCUS, 0);
does work.
Before
After
Although it is definitely the case that calling:
SendMessage(tb1.Handle, WM_UPDATEUISTATE, UIS_CLEAR OR UISF_HIDEFOCUS, 0);
while the control has focus causes the focus rectangle to temporarily re-appear until it loses focus.
Note: I only tried it with styles enabled.
You can prevent TTrackBar
from getting focused by setting its TabStop
property to ˙False`.
When you do this the the dotted line around TTrackBar
won't ever be shown.
Well the only exception is if you have no other focusable component on the form in which case the dotted line still appears when you start interacting with the trackbar.
EDIT: Right I forgot that VCL Styles override the said property amongst many others.
You could modify your VCL style in a way so you disable the FocusEffect
for TTrackBar
and then use this modified style instead.