Click here to Skip to main content
11,410,405 members (58,208 online)
Click here to Skip to main content

Dynamic child window positioning

, 22 Feb 2000
Rate this:
Please Sign up or sign in to vote.
Describes a method to implement resizable child windows.

This article replaces my former article "Dynamic child window positioning" (cdxCDynamicControlsManager).
See the what's new section to find our whether it's worth changing your code.

What's this article about?

I'll introduce you to some of my code that has will make your windows support automatic repositioning of their child controls. I'll call such windows dynamic (since they don't have a static size and child control ordering but dynamic ones):

cdxCDynamicWnd-small.gif (2466 Byte) => cdxCDynamicWnd-big.gif (2928 Byte)

What classes are part of this release?

  • cdxCDynamicWnd, cdxCDynamicWndEx
    General base class(es) used to implement dynamic child window repositioning in any CWnd-derived class.

  • cdxCDynamicDialog
    A CDialog replacement that allows you to dynamically move your controls.

  • cdxCDynamicChildDlg
    The same as a dialog base-class for child window dialogs.

  • cdxCDynamicFormView
    A CFormView, now supports the scrollbars, knows its own size perfectly and stuff!

  • cdxCDynamicPropSheet, cdxCDynamicPropPage
    The dynamic CPropertySheet / CPropertyPage replacement.

  • cdxCDynamicBar, cdxCDynamicBarDlg and cdxCDynamicBarT<>
    A controlbar with an embedded dialog that is dynamically moving its childs.
    The bar itself is derived from the CSizingControlBar published at by Cristi Posea.

What's new in contrast to my former cdxCDynamicControlsMananger + associated classes?

  • New and better code Smile | :)
    This is why we can not simply replace a cdxCDynamicControlsManager code into a cdxCDynamicWnd code. Frown | :(

  • Now works with HWNDs and IDs instead of CWnds.
    Therefore you don't need to explicitely create DDX control variables anymore. *

  • Supports "dynamic maps" - as known from message map macros.
    These maps map IDs to a resizable control. *

  • Now uses ::DeferWindowPos() instead of ::SetWindowPos() to decrease flickering (for all classes). *

  • Anti-Flickering system for cdxCDynamicDialog (looks much better!). *

  • Supports scrolling in CFormView (and any other class, if you enable it by hand). *

  • "Auto-Positioning" feature for dynamic dialogs & property pages. *

  • Support for dialogs that are meant to be "child control dialogs" - if often embedd dialogs and this class helps to make your child controls remain in a suitable place Smile | :)

  • A ControlBar solution.

* ~ Suggested by users of my cdxCDynamicControlsManager Smile | :)

However, since I rewrote much of the code of the cdxCDynamicControlsManager, you cannot switch from that class to my new cdxCDynamicWnd without further work to be done; converting a cdxCSizingDialog into a cdxCDynamicDialog would need help by you.

A documentation file is included in the sub-directory codex/doc/cdxCDynamicWnd-DOC.html.

Any suggestions & bug-reports are welcome.


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

Hans Bühler
Other JP Morgan Chase
Hong Kong Hong Kong
No Biography provided

Comments and Discussions

GeneralDynamic window Pinmemberanup_zade11-Jul-05 4:15 
GeneralcdxCDynamicFormView in a CSplitterWnd pane PinsussAnonymous24-Feb-05 10:29 
GeneralButton of any kind messes up Property Page Pinmembertritonesystems14-Jan-05 5:42 
GeneralRe: Button of any kind messes up Property Page Pinmembertritonesystems17-Jan-05 7:40 
GeneralMoving a child window PinsussArrun6-Jan-05 18:25 
GeneralUrgent!! Problem with win98 Pinmembermfc_surfer18-Sep-04 22:15 
GeneralProperty Page Control Resizing Problem PinsussAnonymous18-Jan-04 22:47 
GeneralMinimize the dialog window PinsussAnonymous8-Dec-03 10:04 
GeneralModeless PinmemberChris Losinger28-Nov-03 10:13 
GeneralExcellent - one of the best CP add-ons I've seen Pinmemberame1220-Oct-03 3:15 
Generalproblem! button was disabled in docked dialog! Pinmemberyoungflea4-Aug-03 23:31 
GeneralRe: problem! button was disabled in docked dialog! PinsussAnonymous30-Oct-03 22:46 
GeneralRe: problem! button was disabled in docked dialog! PinsussAnonymous30-Oct-03 23:10 
GeneralGreat Works!, I have 2 Problems. Pinmembershinsangyong30-Jun-03 17:25 
GeneralThanx for your work Pinmemberjazper1-Apr-03 8:54 
QuestionHow to make all dialog's controls become gray when dialog is disabled?? PinsussProTom13-Mar-03 5:04 
GeneralMenu Options in Dialog Box Application PinsussPrasanthi Inakollu23-Sep-02 13:39 
GeneralResizable UI PinsussSimon Tang19-Sep-02 23:53 
GeneralUpdate a control at run-timer PinmemberJoel Lucsy19-Aug-02 5:14 
QuestionHow to remove Size Grip ? PinmemberXCorra25-Jul-02 6:02 
AnswerRe: How to remove Size Grip ? PinsussAnonymous13-May-03 21:29 
GeneralRe: How to remove Size Grip ? PinsussBadBlue.com9-Oct-03 9:47 
GeneralQuestion about the Layout() function PinmemberChristian Pare12-Jun-02 6:48 
GeneralProblem in XP with ListCtrl in report view on a property page Pinmembersguillaudeu11-Jun-02 12:23 
GeneralRe: Problem in XP with ListCtrl in report view on a property page PinsussAnonymous6-Aug-02 11:59 
GeneralRe: Problem in XP with ListCtrl in report view on a property page PinsussRelieved Developer30-Dec-02 11:24 
GeneralXP problems with prop sheets - thanks for the fix!! Pinmemberame1227-Oct-03 4:38 
GeneralI can't used a Button Control in dialog. PinmemberCloudway24-Feb-02 21:05 
GeneralSolution: I can't used a Button Control in dialog. PinsussEric Orgeron30-Oct-03 23:12 
Questionprogram to reposition other application child windows? PinmemberJoe F26-Jan-02 3:47 
GeneralATL object PinmemberFulvio Corradi9-Oct-01 21:44 
GeneralRe: ATL object Pinmembercorra12-Oct-01 1:59 
GeneralRe: ATL object Pinmemberignacio16-Sep-03 6:13 
QuestionDynamic controls? PinmemberAnonymous27-Jul-01 6:27 
AnswerRe: Dynamic controls? PinmemberMatt Gullett27-Jul-01 7:34 
GeneralRe: Dynamic controls? Pinmemberbrandonl_webguy27-Jul-01 7:47 
QuestionBug? '=' when you meant '=='? PinmemberMark Findlay18-Apr-01 12:24 
AnswerNot a bug - actual assignment w/ test Pinsusssoultech25-Jul-03 6:19 
QuestionHow to keep the relative position of the controls while at the same time resize them. PinsussXia Li19-Oct-00 9:04 
AnswerRe: How to keep the relative position of the controls while at the same time resize them. PinmemberUwe Keim3-Jan-01 1:33 
GeneralGreat work! PinsussMark16-Oct-00 13:56 
QuestionWhen is an mdi child maximized ? PinsussPerry6-Oct-00 23:50 
AnswerRe: When is an mdi child maximized ? PinsussPerry6-Oct-00 23:57 
GeneralRe: When is an mdi child maximized ? PinsussSen18-Oct-00 9:25 
GeneralCool stuff PinsussBuzzLightyear25-May-00 7:33 
GeneralProblems when including the code in a DLL PinsussSen11-May-00 6:34 
GeneralRe: Problems when including the code in a DLL PinsussFrederic Metrich18-Aug-00 3:31 
GeneralLink to source incorrrect... wrong case PinsussThe Obliterator7-Mar-00 11:53 

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.150414.5 | Last Updated 23 Feb 2000
Article Copyright 2000 by Hans Bühler
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid