Rollout Control
Even thought this implementation seems to be a port of the MFC Rollup Control by Johann Nadalutti, I started to develop it some days before the first post of the above-mentioned article. Nevertheless, I need to thank Johann Nadalutti for his great work that gave me the opportunity to improve my implementation.
Rollout Control
This implementation consists of two classes: CRolldownCtrl<TChild>
implements the actual Rolldown control while CRolldownContainer
implements a manager, which provides the visual area for the Rolldown controls.
The class definitions and implementations are in the file AtlRolldownCtrl.h
, which is included in the demo project.
How to use the control in your WTL App
To use this control in your application, add the header file AtlRolldownCtrl.h
to your project and then add CRolloutContainer m_RolloutContainer;
to the class definition that will be using the control.
- Create a dialog box in the resource editor with the
WS_CHILD
style and its WTL dialog class as usual (e.g.CDlg1
).
Note: TrapIDOK
andIDCANCEL
else the dialog will be destroyed if the user presses either RETURN or ESC. - Add
CRolloutCtrl<CDlg1> m_dlg1;
to the class declaration that will be using the control. - Create the control in the
OnCreate
function and add it to the container, e.g.:m_dlg1.Create(m_RolloutContainer.m_hWnd, _T("My Rollout Control")); m_RolloutContainer.AddRollout(m_dlg1);
Repeat these steps for additional Rolldown controls.
The final OnCreate
function may look like this:
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { ... m_RolloutContainer.Create(m_hWnd); ... m_dlg1.Create(m_RolloutContainer.m_hWnd, _T("Rollout Control 1")); m_RolloutContainer.AddRollout(m_dlg1); m_dlg2.Create(m_RolloutContainer.m_hWnd, _T("Rollout Control 2")); m_RolloutContainer.AddRollout(m_dlg2); m_dlg3.Create(m_RolloutContainer.m_hWnd, _T("Rollout Control 3")); m_RolloutContainer.AddRollout(m_dlg3); ...