When using Vcl.StyledComponentsHooks, standard TButton controls are replaced by TStyledButton.
If UseLatestCommonDialogs is set to False, ShowMessage uses the classic VCL dialog, which contains a TButton.
This button is then replaced by TStyledButton.
When no custom VCL style is active (Windows default style), the OK button is displayed incorrectly and is not clickable.
With a custom VCL style active, the dialog works correctly.
With UseLatestCommonDialogs=True, the issue does not occur.
This configuration is commonly used to allow Screen.MessageFont customization for MessageDlg/ShowMessage.
Additional reproduction detail:
The issue only occurs if the first classic ShowMessage is called from an MDI child form.
If a first ShowMessage is called from the MDI main form, then subsequent ShowMessage calls from the MDI child do not show the issue.
So the failing sequence is:
- MDI application
- No custom VCL style active
- Vcl.StyledComponentsHooks used
- UseLatestCommonDialogs := False
- Open an MDI child form
- First ShowMessage call is made from the MDI child
- The OK button is displayed incorrectly / not clickable
Working sequence:
- Same configuration
- First ShowMessage is called from the MDI main form
- Then ShowMessage from MDI child works correctly
This suggests an initialization/order issue in TStyledButton or StyledComponents when the first interposed TButton is created inside a classic VCL dialog owned by an MDI child.
When using Vcl.StyledComponentsHooks, standard TButton controls are replaced by TStyledButton.
If UseLatestCommonDialogs is set to False, ShowMessage uses the classic VCL dialog, which contains a TButton.
This button is then replaced by TStyledButton.
When no custom VCL style is active (Windows default style), the OK button is displayed incorrectly and is not clickable.
With a custom VCL style active, the dialog works correctly.
With UseLatestCommonDialogs=True, the issue does not occur.
This configuration is commonly used to allow Screen.MessageFont customization for MessageDlg/ShowMessage.
Additional reproduction detail:
The issue only occurs if the first classic ShowMessage is called from an MDI child form.
If a first ShowMessage is called from the MDI main form, then subsequent ShowMessage calls from the MDI child do not show the issue.
So the failing sequence is:
Working sequence:
This suggests an initialization/order issue in TStyledButton or StyledComponents when the first interposed TButton is created inside a classic VCL dialog owned by an MDI child.