Fix IsEnabled() return value for wxMSW TLWs with native dialogs
IsEnabled() wrongly returned true even when the TLW was actually disabled due to a native modal dialog using it as owner being currently shown. Fix this by trusting the actual HWND state, rather than our internal m_isEnabled, except before the window is created. Do it for TLWs only even if, in principle, we could check for WS_DISABLED for the other windows too. However this would make IsThisEnabled() inconsistent with the other platforms, where it returns true when the window parent is disabled, but the window itself isn't, which is currently also emulated by wxMSW, but wouldn't be the case if we trusted WS_DISABLED presence. And while there might be other problems due to lying about the actual window state in this function, it doesn't seem to create any problems in practice, so for now leave the old logic in place. As a side effect, this makes wxWindowDisabler work correctly when a message box is shown by another window when it's created, as it will now correctly avoid re-enabling the message box parent in its dtor. Closes https://github.com/wxWidgets/wxWidgets/pull/2117 See #11887.
This commit is contained in:
@@ -655,7 +655,7 @@ public:
|
||||
// state, i.e. the state in which the window would be if all its
|
||||
// parents were enabled (use IsEnabled() above to get the effective
|
||||
// window state)
|
||||
bool IsThisEnabled() const { return m_isEnabled; }
|
||||
virtual bool IsThisEnabled() const { return m_isEnabled; }
|
||||
|
||||
// returns true if the window is visible, i.e. IsShown() returns true
|
||||
// if called on it and all its parents up to the first TLW
|
||||
|
Reference in New Issue
Block a user