Click here to Skip to main content
13,086,662 members (60,096 online)
Click here to Skip to main content
Add your own
alternative version


116 bookmarked
Posted 12 Apr 2001

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;<BR>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

You may also be interested in...


Comments and Discussions

GeneralWerks great. I love it. Pin
Keith Ackermann17-Nov-03 10:20
memberKeith Ackermann17-Nov-03 10:20 
Generalnice Pin
l a u r e n12-Nov-03 5:52
memberl a u r e n12-Nov-03 5:52 
GeneralFantastic control Pin
BadJerry11-Nov-03 23:21
memberBadJerry11-Nov-03 23:21 
GeneralFlickering problem Pin
dmsika19-Aug-03 7:01
memberdmsika19-Aug-03 7:01 
GeneralRe: Flickering problem Pin
dmsika19-Aug-03 7:38
memberdmsika19-Aug-03 7:38 
GeneralStrange Problem Pin
Livid11-Jul-03 7:31
memberLivid11-Jul-03 7:31 
GeneralDynamic resizing Pin
Marsel Khadiyev3-Apr-03 17:45
memberMarsel Khadiyev3-Apr-03 17:45 
GeneralRe: Dynamic resizing Pin
PonT_orionGames19-Feb-07 11:02
memberPonT_orionGames19-Feb-07 11:02 
GeneralCrash when application closes Pin
[HzD]Slider12-Mar-03 2:30
member[HzD]Slider12-Mar-03 2:30 
GeneralRe: Crash when application closes Pin
Ravi Bhavnani19-Mar-03 12:17
memberRavi Bhavnani19-Mar-03 12:17 
General"F***ing VOODOO Magic, man" Pin
Inflicted21-Feb-03 12:10
memberInflicted21-Feb-03 12:10 
GeneralRe: &quot;f***ing VOODOO Magic, man&quot; Pin
drewpy15-Jul-03 14:27
memberdrewpy15-Jul-03 14:27 
GeneralCool Control Pin
Brian Delahunty29-Jan-03 5:02
memberBrian Delahunty29-Jan-03 5:02 
Generalfont question Pin
wpro24-Jan-03 14:18
memberwpro24-Jan-03 14:18 
GeneralIntegrate into Modeless Dialog Pin
Dave W.19-Sep-02 11:22
memberDave W.19-Sep-02 11:22 
GeneralRe: Integrate into Modeless Dialog Pin
Gero Gerber22-Sep-02 3:38
memberGero Gerber22-Sep-02 3:38 
GeneralRe: Integrate into Modeless Dialog Pin
qbert6553614-Dec-02 15:45
memberqbert6553614-Dec-02 15:45 
GeneralRe: Integrate into Modeless Dialog Pin
qbert6553614-Dec-02 19:00
memberqbert6553614-Dec-02 19:00 
GeneralChinese text can't be shown correctly. Pin
Anonymous29-Aug-02 18:14
sussAnonymous29-Aug-02 18:14 
GeneralRe: Chinese text can't be shown correctly. Pin
Anonymous30-Aug-02 13:47
sussAnonymous30-Aug-02 13:47 
QuestionHow work this? Pin
cLIP8-Aug-02 1:56
susscLIP8-Aug-02 1:56 
AnswerRe: How work this? Pin
Nitron22-Nov-02 4:01
memberNitron22-Nov-02 4:01 
GeneralThis is great! Pin
J.G. Hattingh31-Jul-02 23:44
memberJ.G. Hattingh31-Jul-02 23:44 
GeneralTerrific Pin
Anonymous9-Jul-02 12:08
sussAnonymous9-Jul-02 12:08 
GeneralBugfix in RemovePage 2 Pin
Timo Kuehn5-Jun-02 7:20
memberTimo Kuehn5-Jun-02 7:20 
GeneralExcellent, but the background is white Pin
Anonymous28-May-02 7:33
memberAnonymous28-May-02 7:33 
GeneralRe: Excellent, but the background is white Pin
Gero Gerber30-Jul-02 4:30
memberGero Gerber30-Jul-02 4:30 
GeneralRe: Excellent, but the background is white Pin
akevdog23-Jul-03 22:51
memberakevdog23-Jul-03 22:51 
GeneralVariable Pin
ADi.200020-Apr-02 22:45
memberADi.200020-Apr-02 22:45 
GeneralCrash !!!!! Please, help! Pin
paqui3-Apr-02 7:05
memberpaqui3-Apr-02 7:05 
GeneralResize To Fit Window Pin
Matt Newman29-Mar-02 13:08
memberMatt Newman29-Mar-02 13:08 
GeneralRe: Resize To Fit Window Pin
Anonymous17-Jul-02 10:18
sussAnonymous17-Jul-02 10:18 
GeneralRe: Resize To Fit Window Pin
Matt Newman18-Jul-02 9:10
memberMatt Newman18-Jul-02 9:10 
QuestionHow can I change the direction to horizental not to vertical... Pin
Namkyeong Lee28-Jan-02 4:35
memberNamkyeong Lee28-Jan-02 4:35 
Generalc# Pin
Pashabhai24-Jan-02 23:30
memberPashabhai24-Jan-02 23:30 
GeneralBug fix in RemovePage Pin
James French26-Nov-01 5:55
memberJames French26-Nov-01 5:55 
GeneralQuestion Pin
Rob Jones6-Sep-01 18:16
memberRob Jones6-Sep-01 18:16 
GeneralRe: Question Pin
James French11-Sep-01 1:47
memberJames French11-Sep-01 1:47 
GeneralExcellent, with one issue Pin
James French5-Sep-01 1:49
memberJames French5-Sep-01 1:49 
GeneralRe: Excellent, with one issue Pin
Anonymous2-Apr-02 9:18
memberAnonymous2-Apr-02 9:18 
GeneralRe: Excellent, with one issue Pin
CelticEye13-Jul-03 22:32
memberCelticEye13-Jul-03 22:32 
Generaltest message Pin
James French5-Sep-01 1:46
memberJames French5-Sep-01 1:46 
GeneralExcellent work! Pin
Bil Simser17-Aug-01 9:47
memberBil Simser17-Aug-01 9:47 
GeneralDisapearing Page Pin
EnderWiggin10-Jul-01 9:56
memberEnderWiggin10-Jul-01 9:56 
GeneralRe: Disapearing Page Pin
Jens Regulski16-Jul-01 4:09
memberJens Regulski16-Jul-01 4:09 
GeneralRe: Disapearing Page Pin
Anonymous19-Jul-01 14:23
memberAnonymous19-Jul-01 14:23 
GeneralRe: Disapearing Page Pin
Jens Regulski23-Jul-01 3:46
memberJens Regulski23-Jul-01 3:46 
GeneralRe: Disapearing Page Pin
Anonymous25-May-02 7:52
memberAnonymous25-May-02 7:52 
GeneralInteresting but... Pin
Don Sanders7-May-01 3:12
memberDon Sanders7-May-01 3:12 
GeneralRe: Interesting but... Pin
Crispy15-May-01 6:55
memberCrispy15-May-01 6:55 

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

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

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