mardi 5 avril 2016

Force focusrect in Checkbox, ComboBox or TButtonControl

I need to resolve a small and simple situation.

I have forms that the first active control is a CheckBox or ComboBox (TButtonControl). In some cases, when opening the form focusRect is assigned to the control, in other cases not.

Just like to know if there is a way different than I force focusRect in a TButtonControl control.

I tested several ways, but none is effective and works properly.

Sample code used in my TCheckBox:

Procedure TMyCheckBox.CMEnter(Var Message: TCMEnter);
Var
  LRect: TRect;
Begin
  Inherited;
  FillRect(Handle, LRect, Handle);
  DrawFocusRect(Handle, LRect);
End;

The cause of the problem focusRect is simulated as follows . If an application (.exe ) starts with the keyboard focusRect appears automatically, if run with the double click of the mouse, it is not displayed.

It's a Windows feature .

My intention is to force so that the focusRect always appears.

Thanks.




Aucun commentaire:

Enregistrer un commentaire