Fix background of wxRadioBox buttons and wxSlider labels in wxMSW.
Handle WM_CTLCOLOR correctly for them, this wasn't done before because the code assumed that sub-windows (i.e. HWNDs which belong to the same logical wx control) were always children of the main window, but they could also be its siblings (like in at least the two above mentioned cases). Account for this case in wxControl::DoMSWControlColor() too now. Closes #12271. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0ab7522921
commit
b932b899af
@ -380,14 +380,26 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
|
||||
// If this HWND doesn't correspond to a wxWindow, it still might be
|
||||
// one of its children for which we need to set the background
|
||||
// brush, e.g. this is the case for the EDIT control that is part
|
||||
// of wxComboBox. Check for this by asking the parent if it has it:
|
||||
HWND parent = ::GetParent(hWnd);
|
||||
if ( parent )
|
||||
// of wxComboBox but also e.g. of wxSlider label HWNDs which are
|
||||
// logically part of it, but are siblings of the main control at
|
||||
// Windows level.
|
||||
//
|
||||
// So check whether it's a sibling of this window which is part of
|
||||
// the same wx object.
|
||||
if ( ContainsHWND(hWnd) )
|
||||
{
|
||||
wxWindow *winParent = wxFindWinFromHandle( parent );
|
||||
if( winParent && winParent->ContainsHWND( hWnd ) )
|
||||
win = winParent;
|
||||
}
|
||||
win = this;
|
||||
}
|
||||
else // Or maybe a child sub-window of this one.
|
||||
{
|
||||
HWND parent = ::GetParent(hWnd);
|
||||
if ( parent )
|
||||
{
|
||||
wxWindow *winParent = wxFindWinFromHandle( parent );
|
||||
if( winParent && winParent->ContainsHWND( hWnd ) )
|
||||
win = winParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( win )
|
||||
|
Loading…
Reference in New Issue
Block a user