Make disabling the window before creating it actually work

Disabling a window before actually creating it ought to work, similarly
to hiding a window before creating it which can be used to avoid showing
the window on screen at all, even briefly. However it didn't under MSW
where the window was disabled from wxWidgets point of view, but not at
the MSW level.

Fix this by accounting for the enabled state in MSWGetStyle().

Closes #16385.
This commit is contained in:
Vadim Zeitlin
2018-12-09 01:01:49 +01:00
parent edbee125f9
commit dfec7aa0c0
3 changed files with 26 additions and 2 deletions

View File

@@ -102,8 +102,21 @@ void ButtonTestCase::Disabled()
wxUIActionSimulator sim;
//In this test we disable the button and check events are not sent
m_button->Disable();
// In this test we disable the button and check events are not sent and we
// do it once by disabling the previously enabled button and once by
// creating the button in the disabled state.
SECTION("Disable after creation")
{
m_button->Disable();
}
SECTION("Create disabled")
{
delete m_button;
m_button = new wxButton();
m_button->Disable();
m_button->Create(wxTheApp->GetTopWindow(), wxID_ANY, "wxButton");
}
sim.MouseMove(m_button->GetScreenPosition() + wxPoint(10, 10));
wxYield();