Why is AttachDlgItem backwards?

  • Paul Sokolovsky

    Paul Sokolovsky - 2011-01-03

    I have a dialog (this), I want to attach all subcontrols to it. Why would I write

    control.AttachDlgItem(IDC, this)

    instead of

    AttachControl(IDC, control)


    Can you please add such an AttachControl() method? This will make porting MFC's DDX_Control() easier too.

  • David

    David - 2011-01-04

    This sort of thing comes down to personal preference. We can either have the dialog manage the controls, or the controls manage themselves. Having the controls (CWnd's) manage themselves is more consistent with the rest of Win32++  so I prefer the current approach. There is nothing to stop you from having a trivial wrapper for AttachDlgItem called AttachControl in your CDialog derived class if you prefer an alternate approach.

    Best regards,

  • David

    David - 2011-01-07

    I've changed my mind and decided to add a method to CDialog called AttachItem after all.

    Best regards,


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks