Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. WTL DDX with controls, really?

WTL DDX with controls, really?

Scheduled Pinned Locked Moved ATL / WTL / STL
questionc++learning
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Ernesto D
    wrote on last edited by
    #1

    I just dont get it, WTL´s DDX facilities define a DDX_CONTROL() macro that take an ID for a control, and an object to attach it to. However, if i do something like this: BEGIN_DDX_MAP(CMyDlg) DDX_CONTROL(IDC_MYEDIT, m_cEdit) END_DDX_MAP() where IDC_MYEDIT is (of course) and edit box on my dialog, and m_cEdit is a member variable of type CEdit, then this class wont complie! because SubClassWindow() (witch is called by ddx), is NOT a member of CEdit!, i suppose i could write a class derived from CWindowImpl and pass objects of it to DDX_CONTROL(), but i assumed that the whole purpuse of DDX was to make mi life easyer not harder!, it would be FAR more trouble to write a class for EVERY type of control i want to use DDX with, than just create control class member variables on my dialog, and just Attach() them to the "physical" controls on the dialog, early on my OnInitDialog() function! Im i missing something??? what is the purpuse of DDX_CONTROL() if it CANT be used "normally" with controls?

    M L E T 4 Replies Last reply
    0
    • E Ernesto D

      I just dont get it, WTL´s DDX facilities define a DDX_CONTROL() macro that take an ID for a control, and an object to attach it to. However, if i do something like this: BEGIN_DDX_MAP(CMyDlg) DDX_CONTROL(IDC_MYEDIT, m_cEdit) END_DDX_MAP() where IDC_MYEDIT is (of course) and edit box on my dialog, and m_cEdit is a member variable of type CEdit, then this class wont complie! because SubClassWindow() (witch is called by ddx), is NOT a member of CEdit!, i suppose i could write a class derived from CWindowImpl and pass objects of it to DDX_CONTROL(), but i assumed that the whole purpuse of DDX was to make mi life easyer not harder!, it would be FAR more trouble to write a class for EVERY type of control i want to use DDX with, than just create control class member variables on my dialog, and just Attach() them to the "physical" controls on the dialog, early on my OnInitDialog() function! Im i missing something??? what is the purpuse of DDX_CONTROL() if it CANT be used "normally" with controls?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      DDX_CONTROL requires a class with a message map, that is, a CWindowImpl-derived class. The control wrappers are all CWindow-derived, so they can't be used with DDX. You need to do something like:

      class CEditImpl : public CWindowImpl<CEditImpl, CEdit>
      { public: DECLARE_EMPTY_MSG_MAP() };

      and use CEditImpl for your m_cEdit variable. Yes, it's a hassle. :( --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Ericahist updated Aug 30!

      1 Reply Last reply
      0
      • E Ernesto D

        I just dont get it, WTL´s DDX facilities define a DDX_CONTROL() macro that take an ID for a control, and an object to attach it to. However, if i do something like this: BEGIN_DDX_MAP(CMyDlg) DDX_CONTROL(IDC_MYEDIT, m_cEdit) END_DDX_MAP() where IDC_MYEDIT is (of course) and edit box on my dialog, and m_cEdit is a member variable of type CEdit, then this class wont complie! because SubClassWindow() (witch is called by ddx), is NOT a member of CEdit!, i suppose i could write a class derived from CWindowImpl and pass objects of it to DDX_CONTROL(), but i assumed that the whole purpuse of DDX was to make mi life easyer not harder!, it would be FAR more trouble to write a class for EVERY type of control i want to use DDX with, than just create control class member variables on my dialog, and just Attach() them to the "physical" controls on the dialog, early on my OnInitDialog() function! Im i missing something??? what is the purpuse of DDX_CONTROL() if it CANT be used "normally" with controls?

        L Offline
        L Offline
        Li Lirong
        wrote on last edited by
        #3

        You can try CContainedWindowT. Regards, Lirong

        1 Reply Last reply
        0
        • E Ernesto D

          I just dont get it, WTL´s DDX facilities define a DDX_CONTROL() macro that take an ID for a control, and an object to attach it to. However, if i do something like this: BEGIN_DDX_MAP(CMyDlg) DDX_CONTROL(IDC_MYEDIT, m_cEdit) END_DDX_MAP() where IDC_MYEDIT is (of course) and edit box on my dialog, and m_cEdit is a member variable of type CEdit, then this class wont complie! because SubClassWindow() (witch is called by ddx), is NOT a member of CEdit!, i suppose i could write a class derived from CWindowImpl and pass objects of it to DDX_CONTROL(), but i assumed that the whole purpuse of DDX was to make mi life easyer not harder!, it would be FAR more trouble to write a class for EVERY type of control i want to use DDX with, than just create control class member variables on my dialog, and just Attach() them to the "physical" controls on the dialog, early on my OnInitDialog() function! Im i missing something??? what is the purpuse of DDX_CONTROL() if it CANT be used "normally" with controls?

          E Offline
          E Offline
          Ernesto D
          wrote on last edited by
          #4

          Thanks for your answers Michael & Li, i know i need a CWindowImpl derived class to do the job, but what i mean is, i dont understand the phylosofy (pardon my spelling if wrong, english is not my native language) of the creators of WTL in this issue, because what DDX_CONTROL is supposed to do, its easier done -without- DDX_CONTROL!. I find it "harder" (more time consuming) to have to write a class(even a small one) for every type of control i want to use, include the proper headers on my dialog class, add the ddx map entry, etc., than just declaring a member variable like CEdit m_MyEdit, or CListViewCtrl m_MyList, etc. and just attaching it via their Attach() method on my dialog´s OnInitDialog(), my point is ¿whats the design concept behind DDX_CONTROL? or in other words, ¿when do you actually use DDX_CONTROL because its easier to do so?

          M 1 Reply Last reply
          0
          • E Ernesto D

            Thanks for your answers Michael & Li, i know i need a CWindowImpl derived class to do the job, but what i mean is, i dont understand the phylosofy (pardon my spelling if wrong, english is not my native language) of the creators of WTL in this issue, because what DDX_CONTROL is supposed to do, its easier done -without- DDX_CONTROL!. I find it "harder" (more time consuming) to have to write a class(even a small one) for every type of control i want to use, include the proper headers on my dialog class, add the ddx map entry, etc., than just declaring a member variable like CEdit m_MyEdit, or CListViewCtrl m_MyList, etc. and just attaching it via their Attach() method on my dialog´s OnInitDialog(), my point is ¿whats the design concept behind DDX_CONTROL? or in other words, ¿when do you actually use DDX_CONTROL because its easier to do so?

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Ernesto D. wrote: declaring a member variable like CEdit m_MyEdit, or CListViewCtrl m_MyList, etc. and just attaching it via their Attach() method on my dialog´s OnInitDialog(), I would rather have a map in the header file, which is easy to find and edit, than calls to Attach(GetDlgItem(IDC_FOO)) over and over. The code to hook up all the controls at once with DDX is just one line, DoDataExchange(false); Using Attach() will work just as well, if that's the way you prefer. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Ericahist updated Aug 30!

            1 Reply Last reply
            0
            • E Ernesto D

              I just dont get it, WTL´s DDX facilities define a DDX_CONTROL() macro that take an ID for a control, and an object to attach it to. However, if i do something like this: BEGIN_DDX_MAP(CMyDlg) DDX_CONTROL(IDC_MYEDIT, m_cEdit) END_DDX_MAP() where IDC_MYEDIT is (of course) and edit box on my dialog, and m_cEdit is a member variable of type CEdit, then this class wont complie! because SubClassWindow() (witch is called by ddx), is NOT a member of CEdit!, i suppose i could write a class derived from CWindowImpl and pass objects of it to DDX_CONTROL(), but i assumed that the whole purpuse of DDX was to make mi life easyer not harder!, it would be FAR more trouble to write a class for EVERY type of control i want to use DDX with, than just create control class member variables on my dialog, and just Attach() them to the "physical" controls on the dialog, early on my OnInitDialog() function! Im i missing something??? what is the purpuse of DDX_CONTROL() if it CANT be used "normally" with controls?

              T Offline
              T Offline
              TW
              wrote on last edited by
              #6

              We converted some of our small-size projects to WTL previously. Now we are skeptical putting more effort on WTL, as Microsoft now seems don't even want to improve MFC/ATL beside keep pushing (implicitly forcing...) .nut for C/C++, which in our view, would eventually kill C/C++ on Windows. :mad: Anyone with any idea is WTL dead? :((

              S 1 Reply Last reply
              0
              • T TW

                We converted some of our small-size projects to WTL previously. Now we are skeptical putting more effort on WTL, as Microsoft now seems don't even want to improve MFC/ATL beside keep pushing (implicitly forcing...) .nut for C/C++, which in our view, would eventually kill C/C++ on Windows. :mad: Anyone with any idea is WTL dead? :((

                S Offline
                S Offline
                Steve S
                wrote on last edited by
                #7

                There was some talk of it going open-source, which would probably be enough to kill it effectively :laugh: but Nenad is supposedly working on 7.1 or 8, partly to improve the support out of the box for VS.NET 2003, which otherwise requires some tweaks. Steve S

                J 1 Reply Last reply
                0
                • S Steve S

                  There was some talk of it going open-source, which would probably be enough to kill it effectively :laugh: but Nenad is supposedly working on 7.1 or 8, partly to improve the support out of the box for VS.NET 2003, which otherwise requires some tweaks. Steve S

                  J Offline
                  J Offline
                  Jorgen Sigvardsson
                  wrote on last edited by
                  #8

                  Steve S wrote: which otherwise requires some tweaks. Some? :rolleyes: COM Out-proc server are easy to fix, but COM DLL's and WTL is a hassle. I ended up writing an adapter class for the COM Module stuff. :sigh: -- You still have your old friend Zoidberg. You all have Zoidberg!

                  S 1 Reply Last reply
                  0
                  • J Jorgen Sigvardsson

                    Steve S wrote: which otherwise requires some tweaks. Some? :rolleyes: COM Out-proc server are easy to fix, but COM DLL's and WTL is a hassle. I ended up writing an adapter class for the COM Module stuff. :sigh: -- You still have your old friend Zoidberg. You all have Zoidberg!

                    S Offline
                    S Offline
                    Steve S
                    wrote on last edited by
                    #9

                    Nenad has announced in the WTL ng that he'll be releasing a new version 'soon', which is fundamentally bug-fixes. I'm sure someone will announce it here when it happens. Steve S

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups