Skip to content

Vcl.StyledComponentsHooks: first classic ShowMessage from MDI child has unusable OK button when no VCL style is active #103

Description

@surfjf69

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:

  1. MDI application
  2. No custom VCL style active
  3. Vcl.StyledComponentsHooks used
  4. UseLatestCommonDialogs := False
  5. Open an MDI child form
  6. First ShowMessage call is made from the MDI child
  7. The OK button is displayed incorrectly / not clickable

Working sequence:

  1. Same configuration
  2. First ShowMessage is called from the MDI main form
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions