From 3ae8462bbe450fe9d324e6f04aaa113bfb545cdd Mon Sep 17 00:00:00 2001 From: ppescher Date: Wed, 3 Jan 2018 19:20:58 +0100 Subject: [PATCH] added function override for AddAllOtherAnchors added missing argument to specify bottom right corner --- ResizableComboBox/DemoDlg.cpp | 2 ++ ResizableLib/ResizableLayout.cpp | 6 ++++-- ResizableLib/ResizableLayout.h | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ResizableComboBox/DemoDlg.cpp b/ResizableComboBox/DemoDlg.cpp index 8105b5f..fa9d83e 100644 --- a/ResizableComboBox/DemoDlg.cpp +++ b/ResizableComboBox/DemoDlg.cpp @@ -56,6 +56,8 @@ BOOL CDemoDlg::OnInitDialog() AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_EDIT1, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_LIST1, TOP_RIGHT, BOTTOM_RIGHT); + + AddAllOtherAnchors(TOP_LEFT, TOP_RIGHT); m_ctrlList1.AddString(_T("a very very very loooong item text")); m_ctrlList1.SetHorizontalExtent(400); diff --git a/ResizableLib/ResizableLayout.cpp b/ResizableLib/ResizableLayout.cpp index f861ea3..2dd5422 100644 --- a/ResizableLib/ResizableLayout.cpp +++ b/ResizableLib/ResizableLayout.cpp @@ -112,6 +112,8 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB * This function adds all the controls not yet added to the layout manager * and sets anchor points for its top-left and bottom-right corners. * + * @param anchorTopLeft Anchor point for the top-left corner + * @param anchorBottomRight Anchor point for the bottom-right corner * @param anchor Anchor point for the top-left and bottom-right corner * * @remarks Overlapping controls, like group boxes and the controls inside, @@ -120,7 +122,7 @@ void CResizableLayout::AddAnchor(HWND hWnd, ANCHOR anchorTopLeft, ANCHOR anchorB * * @sa AddAnchor */ -void CResizableLayout::AddAllOtherAnchors(ANCHOR anchor) +void CResizableLayout::AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBottomRight) { HWND hParent = GetResizableWnd()->GetSafeHwnd(); ASSERT(::IsWindow(hParent)); @@ -130,7 +132,7 @@ void CResizableLayout::AddAllOtherAnchors(ANCHOR anchor) { POSITION pos; if (!m_mapLayout.Lookup(hWnd, pos)) - AddAnchor(hWnd, anchor, anchor); + AddAnchor(hWnd, anchorTopLeft, anchorBottomRight); hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT); } diff --git a/ResizableLib/ResizableLayout.h b/ResizableLib/ResizableLayout.h index 8abfe70..795fe0b 100644 --- a/ResizableLib/ResizableLayout.h +++ b/ResizableLib/ResizableLayout.h @@ -206,7 +206,12 @@ class CResizableLayout //@{ //! @brief Add anchor points for all the remaining controls to the layout - void AddAllOtherAnchors(ANCHOR anchor); + void AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBottomRight); + + void AddAllOtherAnchors(ANCHOR anchor) + { + AddAllOtherAnchors(anchor, anchor); + } void AddAllOtherAnchors() {