Fix text selection in combo boxes of find/replace dialog problem on resize
Fixes #3367, closes #3416
This commit is contained in:
parent
3aa8535d5d
commit
0d90ad1374
|
@ -713,16 +713,28 @@ void FindReplaceDlg::resizeDialogElements(LONG newWidth)
|
||||||
IDREPLACE, IDREPLACEALL,IDC_REPLACE_OPENEDFILES, IDD_FINDINFILES_FIND_BUTTON, IDD_FINDINFILES_REPLACEINFILES, IDC_FINDPREV, IDOK, IDCANCEL,
|
IDREPLACE, IDREPLACEALL,IDC_REPLACE_OPENEDFILES, IDD_FINDINFILES_FIND_BUTTON, IDD_FINDINFILES_REPLACEINFILES, IDC_FINDPREV, IDOK, IDCANCEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
_deltaWidth = newWidth - _initialClientWidth;
|
const UINT flags = SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS;
|
||||||
auto addWidth = _deltaWidth - _lastDeltaWidth;
|
|
||||||
_lastDeltaWidth = _deltaWidth;
|
auto newDeltaWidth = newWidth - _initialClientWidth;
|
||||||
|
auto addWidth = newDeltaWidth - _deltaWidth;
|
||||||
|
_deltaWidth = newDeltaWidth;
|
||||||
|
|
||||||
RECT rc;
|
RECT rc;
|
||||||
for (int id : resizeWindowIDs)
|
for (int id : resizeWindowIDs)
|
||||||
{
|
{
|
||||||
HWND resizeHwnd = ::GetDlgItem(_hSelf, id);
|
HWND resizeHwnd = ::GetDlgItem(_hSelf, id);
|
||||||
::GetClientRect(resizeHwnd, &rc);
|
::GetClientRect(resizeHwnd, &rc);
|
||||||
::SetWindowPos(resizeHwnd, NULL, 0, 0, rc.right + addWidth, rc.bottom, SWP_NOMOVE | SWP_NOZORDER);
|
|
||||||
|
// Combo box for some reasons selects text on resize. So let's check befor resize if selection is present and clear it manually after resize.
|
||||||
|
DWORD endSelection = 0;
|
||||||
|
SendMessage(resizeHwnd, CB_GETEDITSEL, 0, (LPARAM)&endSelection);
|
||||||
|
|
||||||
|
::SetWindowPos(resizeHwnd, NULL, 0, 0, rc.right + addWidth, rc.bottom, SWP_NOMOVE | flags);
|
||||||
|
|
||||||
|
if (endSelection == 0)
|
||||||
|
{
|
||||||
|
SendMessage(resizeHwnd, CB_SETEDITSEL, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int moveWndID : moveWindowIDs)
|
for (int moveWndID : moveWindowIDs)
|
||||||
|
@ -731,15 +743,14 @@ void FindReplaceDlg::resizeDialogElements(LONG newWidth)
|
||||||
::GetWindowRect(moveHwnd, &rc);
|
::GetWindowRect(moveHwnd, &rc);
|
||||||
::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rc, 2);
|
::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rc, 2);
|
||||||
|
|
||||||
::SetWindowPos(moveHwnd, NULL, rc.left + addWidth, rc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
|
::SetWindowPos(moveHwnd, NULL, rc.left + addWidth, rc.top, 0, 0, SWP_NOSIZE | flags);
|
||||||
::InvalidateRect(moveHwnd, NULL, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto additionalWindowHwndsToResize = { _tab.getHSelf() , _statusBar.getHSelf() };
|
auto additionalWindowHwndsToResize = { _tab.getHSelf() , _statusBar.getHSelf() };
|
||||||
for (HWND resizeHwnd : additionalWindowHwndsToResize)
|
for (HWND resizeHwnd : additionalWindowHwndsToResize)
|
||||||
{
|
{
|
||||||
::GetClientRect(resizeHwnd, &rc);
|
::GetClientRect(resizeHwnd, &rc);
|
||||||
::SetWindowPos(resizeHwnd, NULL, 0, 0, rc.right + addWidth, rc.bottom, SWP_NOMOVE | SWP_NOZORDER);
|
::SetWindowPos(resizeHwnd, NULL, 0, 0, rc.right + addWidth, rc.bottom, SWP_NOMOVE | flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,6 @@ protected :
|
||||||
|
|
||||||
private :
|
private :
|
||||||
RECT _initialWindowRect;
|
RECT _initialWindowRect;
|
||||||
LONG _lastDeltaWidth;
|
|
||||||
LONG _deltaWidth;
|
LONG _deltaWidth;
|
||||||
LONG _initialClientWidth;
|
LONG _initialClientWidth;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue