Skip to content

Commit

Permalink
updated callback item, now using GetAnchorPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
ppescher committed Oct 13, 2002
1 parent db9f799 commit 310b12b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions ResizableLib/ResizableSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static UINT _propButtons[] =
IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP,
ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH
};
const int _propButtonsCount = sizeof(_propButtons)/sizeof(UINT);

// horizontal line in wizard mode
#define ID_WIZLINE ID_WIZFINISH+1
Expand Down Expand Up @@ -164,7 +165,7 @@ void CResizableSheet::PresetLayout()
m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();

// add all possible buttons, if they exist
for (int i = 0; i < 7; i++)
for (int i = 0; i < _propButtonsCount; i++)
{
if (NULL != GetDlgItem(_propButtons[i]))
AddAnchor(_propButtons[i], BOTTOM_RIGHT);
Expand All @@ -177,7 +178,7 @@ BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout)
return CResizableLayout::ArrangeLayoutCallback(layout);

// set layout info for active page
layout.hWnd = (HWND)::SendMessage(GetSafeHwnd(), PSM_GETCURRENTPAGEHWND, 0, 0);
layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0);
if (!::IsWindow(layout.hWnd))
return FALSE;

Expand All @@ -190,15 +191,17 @@ BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout)
}
else // tab mode
{
CTabCtrl* pTab = GetTabControl();
ASSERT(pTab != NULL);

// get tab position after resizing and calc page rect
CRect rectPage, rectSheet;
GetTotalClientRect(&rectSheet);

CTabCtrl* pTab = GetTabControl();
pTab->GetWindowRect(&rectPage);
VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage));
pTab->AdjustRect(FALSE, &rectPage);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);

// use tab control
// set margins
layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
}
Expand Down
10 changes: 6 additions & 4 deletions ResizableLib/ResizableSheetEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,17 @@ BOOL CResizableSheetEx::ArrangeLayoutCallback(LayoutInfo &layout)
}
else // tab mode
{
CTabCtrl* pTab = GetTabControl();
ASSERT(pTab != NULL);

// get tab position after resizing and calc page rect
CRect rectPage, rectSheet;
GetTotalClientRect(&rectSheet);

CTabCtrl* pTab = GetTabControl();
pTab->GetWindowRect(&rectPage);
VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage));
pTab->AdjustRect(FALSE, &rectPage);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);

// use tab control
// set margins
layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
}
Expand Down

0 comments on commit 310b12b

Please sign in to comment.