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

Dynamic child window positioning

By , 22 Feb 2000
 

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 CodeGuru.com by Cristi Posea.

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

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

  • 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 :)

  • A ControlBar solution.

* ~ Suggested by users of my cdxCDynamicControlsManager :)

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.

License

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
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralResizeable dialogbar not showing the controlsmembergbalajimecse16 Apr '10 - 20:21 
Generalmigrating to VS 2008membermlchavez2 Feb '10 - 9:14 
GeneralRe: migrating to VS 2008memberHans Bühler3 Feb '10 - 4:41 
GeneralNits so compiles with warning level 4memberl_d_allan5 Nov '08 - 7:42 
1. Project file should have "Additional Include Directories" set to ..\codex
 
2. There are a number of warnings related to "assignment within conditional", including the definition of BEGIN_DYNAMIC_MAP(CLASS,BASECLASS)
 
It was:
#define BEGIN_DYNAMIC_MAP(CLASS,BASECLASS) \
const cdxCDynamicWnd::__dynEntry *CLASS::__getDynMap(const __dynEntry *pLast) const\
{ \
if(pLast == __M_dynEntry) \
return NULL; \
return (pLast = BASECLASS::__getDynMap(pLast)) ? pLast : __M_dynEntry; \
} \
const cdxCDynamicWnd::__dynEntry CLASS::__M_dynEntry[] = {
 

and to avoid warning, should be:
#define BEGIN_DYNAMIC_MAP(CLASS,BASECLASS) \
const cdxCDynamicWnd::__dynEntry *CLASS::__getDynMap(const __dynEntry *pLast) const\
{ \
if(pLast == __M_dynEntry) \
return NULL; \
return (((pLast = BASECLASS::__getDynMap(pLast))) != 0) ? pLast : __M_dynEntry; \
} \
const cdxCDynamicWnd::__dynEntry CLASS::__M_dynEntry[] = {
QuestionFYI small bug?memberJens froslev-nielsen15 May '07 - 2:36 
GeneralProblem with propertysheet multiline TabControlmemberDieter Hammer19 Dec '06 - 23:40 
QuestionModeless sheet bug?memberIonut Codrut7 Dec '06 - 4:31 
QuestionSize problemsmembermluri23 Nov '06 - 22:44 
Questionhelp me,plsmemberaiqin20 Oct '06 - 16:14 
QuestionRe: help me,plsmemberaiqin20 Oct '06 - 16:25 
GeneralDynamic windowmemberanup_zade11 Jul '05 - 3:15 
GeneralcdxCDynamicFormView in a CSplitterWnd panesussAnonymous24 Feb '05 - 9:29 
GeneralButton of any kind messes up Property Pagemembertritonesystems14 Jan '05 - 4:42 
GeneralRe: Button of any kind messes up Property Pagemembertritonesystems17 Jan '05 - 6:40 
GeneralMoving a child windowsussArrun6 Jan '05 - 17:25 
GeneralUrgent!! Problem with win98membermfc_surfer18 Sep '04 - 21:15 
GeneralProperty Page Control Resizing ProblemsussAnonymous18 Jan '04 - 21:47 
GeneralMinimize the dialog windowsussAnonymous8 Dec '03 - 9:04 
GeneralModelessmemberChris Losinger28 Nov '03 - 9:13 
GeneralExcellent - one of the best CP add-ons I've seenmemberame1220 Oct '03 - 2:15 
Generalproblem! button was disabled in docked dialog!memberyoungflea4 Aug '03 - 22:31 
GeneralRe: problem! button was disabled in docked dialog!sussAnonymous30 Oct '03 - 21:46 
GeneralRe: problem! button was disabled in docked dialog!sussAnonymous30 Oct '03 - 22:10 
GeneralGreat Works!, I have 2 Problems.membershinsangyong30 Jun '03 - 16:25 
GeneralThanx for your workmemberjazper1 Apr '03 - 7:54 

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 23 Feb 2000
Article Copyright 2000 by Hans Bühler
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid