Click here to Skip to main content
Click here to Skip to main content

Rollup Control

, 16 Dec 2003
Rate this:
Please Sign up or sign in to vote.
A 3DSMax like Rollup control


I wanted the same graphic control that 3DSMax use in the pages 'create' and 'modify'. It is called a 'Rollup Window Control', which allows one to roll and unroll dialog boxes and to scroll them in the control's client area. The CRollupCtrl MFC class is the result. The class definition and implementation are in the files RollupCtrl.h and RollupCtrl.cpp, which are included in the demo project.


  • The control is derived from the CWnd class and can be created in any window. <!--
  • The insertion of a dialog box in the control is made by the intermediate of pages.
  • -->
  • Pages are composed of a title, visualized by a button and a template (the dialog box).
  • Pages can have several states. They can be rolled/unrolled but can also be active and inactive. To roll-unroll a page allows you to hide or show dialog box, respectively. To deactivate a page, lock the dialog box in the rolled state.
  • The control is resizable and can also scroll pages. To scroll pages you can use the scrollbar or click inside an open dialog box and drag outside it to scroll the control.

Using the Control

To use this control in your application, add the RollupCtrl.h and RollupCtrl.cpp files to your project. The creation of the control is made by calling the CRollupCtrl::Create(...) method. There are two ways to insert a page.

  1. RUNTIME_CLASS method

    Create a dialog box in the resource editor 'ex. IDD_PAGE1' with the WS_CHILD style. Generate the declaration and implementation files class (ex. CPage1Dlg) of your dialog box with the assistance of the MFC Classwizard. Then add DECLARE_DYNCREATE(CPage1Dlg) in the declaration of the class and IMPLEMENT_DYNCREATE(CPage1Dlg, CDialog) in the implementation.

    Then insert the page in this way pwndRollupCtrl->InsertPage("Caption", IDD_PAGE1, RUNTIME_CLASS(CPage1Dlg) );

  2. CDialog::Create method

    As RUNTIME_CLASS method, create a dialog box in the resource editor. Generate the declaration and implementation files class of your dialog box. Then create the dialog box like this

    CPage1Dlg* pwndPage1 = new CPage1Dlg;
    pwndPage1->Create(MAKEINTRESOURCE(IDD_PAGE1), pwndRollupCtrl);

    and insert the page as follows

    pwndRollupCtrl->InsertPage("Caption", pwndPage1 );

This code has been tested only on W2K. If you have any other suggested improvements, please let me know for the next release.

User Methods


BOOL     Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
int      InsertPage(const char* caption, CDialog* pwndTemplate,
                   BOOL bAutoDestroyTpl=TRUE, int idx=-1);
int      InsertPage(const char* caption, UINT nIDTemplate, int idx=-1);
int      InsertPage(const char* caption, UINT nIDTemplate, 
                   CRuntimeClass* rtc, int idx=-1);
void     RemovePage(int idx);
void     RemoveAllPages();
void     ExpandPage(int idx, BOOL bExpand=TRUE);    
void     ExpandAllPages(BOOL bExpand=TRUE);
void     EnablePage(int idx, BOOL bEnable=TRUE);
void     EnableAllPages(BOOL bEnable=TRUE);
RC_PAGEINFO* CRollupCtrl::GetPageInfo(int idx); 


void     ScrollToPage(int idx, BOOL bAtTheTop=TRUE);
int     MovePageAt(int idx, int newidx);
BOOL     IsPageExpanded(int idx);
BOOL     IsPageEnabled(int idx);
int     GetPagesCount();


BOOL     IsAutoColumnsEnabled();
void     EnableAutoColumns(BOOL bEnable=TRUE);
BOOL     SetColumnWidth(int nWidth);
BOOL     SetPageCaption(int idx, LPCSTR caption); 


  • v1.0
    31/03/01: Created
  • v1.01
    13/04/01: Added ScrollToPage method
    Added automatic page visibility to ExpandPage method
    Added Mousewheel support
    15/04/01: Added mouse capture checking on WM_MOUSEMOVE dialog msg
    Added SetCursor on Dialog WM_SETCURSOR
    Added MovePageAt method
    17/04/01: Fixed Group Boxes displayed over Buttons
    20/04/01: Added IsPageExpanded and IsPageExpanded methods
    Added PopupMenu
    Added Button subclassing (now button's focus not drawn)
  • v1.02
    10/06/02: Added pages dividing up into columns
    17/06/02: Added SetPageCaption method
    19/11/02: Fixed _RemovePage method
    29/10/03: Background color for AfxRegisterWndClass


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

No Biography provided

Comments and Discussions

GeneralMy vote of 5 Pinmembercalmman.yang29-Feb-12 0:31 
GeneralMy vote of 5 Pinmemberlwonc29-Dec-11 17:12 
QuestionIntegrated with "Rollup Control" with "Simple Tab Control For Visual C++" possible? Pinmemberakira3214-Jan-09 8:20 
GeneralA Very Good Tool PinmemberChandrasekharanp15-Sep-08 2:04 
GeneralHelp please - incorporating Rollup into a Dialog Based MFC Application PinmemberRobbieGregg3-Sep-08 23:57 
GeneralDinamical adding a new button or edit box PinmemberMember 414549316-Apr-08 7:14 
GeneralMDI application and RollUp PinmemberLaursl20-Nov-07 0:20 
GeneralRe: MDI application and RollUp PinmemberLaursl20-Nov-07 3:36 
Generalso great Pinmemberdazedase17-Aug-07 18:41 
GeneralInsert &quot;Rollup Controls&quot; into Tabs Pinmembersaviorman19-Oct-05 16:06 
GeneralFeature Request PinmemberBob McCown15-Oct-04 3:39 
QuestionC#/.Net/WinForms version? Pinmemberjeffb4218-Jun-04 16:56 
Generalcustom control flickers PinmemberIsidor18-Jan-04 7:27 
QuestionHow to make a Dockable &quot;TabPan&quot; with this DialogBar just like 3DS MAX ? Pinmembersgy2322-Dec-03 0:29 
QuestionCan someone forward the source code to me?? Thanks!! Pinmemberunivega_r3042-Dec-03 14:21 
AnswerRe: Can someone forward the source code to me?? Thanks!! Pinmemberaseemann3-Dec-03 21:52 
GeneralRe: Can someone forward the source code to me?? Thanks!! Pinmemberkiran_ts4-Dec-03 6:57 
Try this

Wink | ;)
GeneralRe: Can someone forward the source code to me?? Thanks!! Pinmemberunivega_r3045-Dec-03 5:34 
GeneralAnother fix to _RemovePage method PinmemberZaffari2-Dec-03 9:07 
QuestionSource 404? PinmemberRavi Bhavnani25-Nov-03 7:04 
GeneralPatented Pinmembercompiler22-Nov-03 20:01 
GeneralRe: Patented PinmemberSven Axelsson17-Dec-03 3:42 
GeneralRe: Patented PinmemberTriac8-Jan-04 22:26 
GeneralRe: Patented Pinmembersteblublu17-Feb-06 5:02 
Generaldrag page to reposition Pinmembersovann21-Nov-03 0:43 
GeneralWerks great. I love it. PinmemberKeith Ackermann17-Nov-03 11:20 
Generalnice Pinmemberl a u r e n12-Nov-03 6:52 
GeneralFantastic control PinmemberBadJerry12-Nov-03 0:21 
GeneralFlickering problem Pinmemberdmsika19-Aug-03 8:01 
GeneralRe: Flickering problem Pinmemberdmsika19-Aug-03 8:38 
GeneralStrange Problem PinmemberLivid11-Jul-03 8:31 
GeneralDynamic resizing PinmemberMarsel Khadiyev3-Apr-03 18:45 
GeneralRe: Dynamic resizing PinmemberPonT_orionGames19-Feb-07 12:02 
GeneralCrash when application closes Pinmember[HzD]Slider12-Mar-03 3:30 
GeneralRe: Crash when application closes PinmemberRavi Bhavnani19-Mar-03 13:17 
General"f***ing VOODOO Magic, man" PinmemberInflicted21-Feb-03 13:10 
GeneralRe: &quot;f***ing VOODOO Magic, man&quot; Pinmemberdrewpy15-Jul-03 15:27 
GeneralCool Control PinmemberBrian Delahunty29-Jan-03 6:02 
Generalfont question Pinmemberwpro24-Jan-03 15:18 
GeneralIntegrate into Modeless Dialog PinmemberDave W.19-Sep-02 12:22 
GeneralRe: Integrate into Modeless Dialog PinmemberGero Gerber22-Sep-02 4:38 
GeneralRe: Integrate into Modeless Dialog Pinmemberqbert6553614-Dec-02 16:45 
GeneralRe: Integrate into Modeless Dialog Pinmemberqbert6553614-Dec-02 20:00 
GeneralChinese text can't be shown correctly. PinsussAnonymous29-Aug-02 19:14 
GeneralRe: Chinese text can't be shown correctly. PinsussAnonymous30-Aug-02 14:47 
QuestionHow work this? PinsusscLIP8-Aug-02 2:56 
AnswerRe: How work this? PinmemberNitron22-Nov-02 5:01 
GeneralThis is great! PinmemberJ.G. Hattingh1-Aug-02 0:44 
GeneralTerrific PinsussAnonymous9-Jul-02 13:08 
GeneralBugfix in RemovePage 2 PinmemberTimo Kuehn5-Jun-02 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150331.1 | Last Updated 17 Dec 2003
Article Copyright 2001 by Johann Nadalutti
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid