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. C / C++ / MFC
  4. DDX and Arrays

DDX and Arrays

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++visual-studiodata-structures
11 Posts 5 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.
  • S Offline
    S Offline
    stevepqr
    wrote on last edited by
    #1

    VS6.0, C++ I have a control I need to 'interact' with, I set it up the usual way with ID = IDC_TINY1 and using ClassWizard to assign a variable CStatic m_Tiny1, as expected this gives me:- DDX_Control(pDX, IDC_TINY1, m_Tiny1); and in the header:- CStatic m_Tiny1; Now though I have 11 more identical controls and instead of having m_Tiny1, m_Tiny2, m_Tiny3 etc I think it would be better to have an array m_Tiny[12] but there seems to be no way to assign each element of the array using ClassWizard. So I decided to edit these entries manually to give me:- DDX_Control(pDX, IDC_TINY1, m_Tiny[0]); DDX_Control(pDX, IDC_TINY2, m_Tiny[1]); DDX_Control(pDX, IDC_TINY3, m_Tiny[2]); . . . DDX_Control(pDX, IDC_TINY12, m_Tiny[11]); and:- CStatic m_Tiny[12]; This appeared to work just fine until I came to edit another control using ClassWizard I then got the error:- Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]" I'm assuming this is VS telling me I have an entry in the DDX that it didn't put there even though it quite happily will compile and run it. So to the problem: Is having array elements in DDX entries a valid thing to do? If yes then how do I do it without the error? Thanks

    Apathy Rules - I suppose...

    Its not the things you fear that come to get you but all the things that you don't expect

    C C O 3 Replies Last reply
    0
    • S stevepqr

      VS6.0, C++ I have a control I need to 'interact' with, I set it up the usual way with ID = IDC_TINY1 and using ClassWizard to assign a variable CStatic m_Tiny1, as expected this gives me:- DDX_Control(pDX, IDC_TINY1, m_Tiny1); and in the header:- CStatic m_Tiny1; Now though I have 11 more identical controls and instead of having m_Tiny1, m_Tiny2, m_Tiny3 etc I think it would be better to have an array m_Tiny[12] but there seems to be no way to assign each element of the array using ClassWizard. So I decided to edit these entries manually to give me:- DDX_Control(pDX, IDC_TINY1, m_Tiny[0]); DDX_Control(pDX, IDC_TINY2, m_Tiny[1]); DDX_Control(pDX, IDC_TINY3, m_Tiny[2]); . . . DDX_Control(pDX, IDC_TINY12, m_Tiny[11]); and:- CStatic m_Tiny[12]; This appeared to work just fine until I came to edit another control using ClassWizard I then got the error:- Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]" I'm assuming this is VS telling me I have an entry in the DDX that it didn't put there even though it quite happily will compile and run it. So to the problem: Is having array elements in DDX entries a valid thing to do? If yes then how do I do it without the error? Thanks

      Apathy Rules - I suppose...

      Its not the things you fear that come to get you but all the things that you don't expect

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      stevepqr wrote:

      Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]"

      You forgot ");" at the end of the line. That's exactly what VS is telling you also :)

      Cédric Moonen Software developer
      Charting control [v2.0] OpenGL game tutorial in C++

      C C 2 Replies Last reply
      0
      • S stevepqr

        VS6.0, C++ I have a control I need to 'interact' with, I set it up the usual way with ID = IDC_TINY1 and using ClassWizard to assign a variable CStatic m_Tiny1, as expected this gives me:- DDX_Control(pDX, IDC_TINY1, m_Tiny1); and in the header:- CStatic m_Tiny1; Now though I have 11 more identical controls and instead of having m_Tiny1, m_Tiny2, m_Tiny3 etc I think it would be better to have an array m_Tiny[12] but there seems to be no way to assign each element of the array using ClassWizard. So I decided to edit these entries manually to give me:- DDX_Control(pDX, IDC_TINY1, m_Tiny[0]); DDX_Control(pDX, IDC_TINY2, m_Tiny[1]); DDX_Control(pDX, IDC_TINY3, m_Tiny[2]); . . . DDX_Control(pDX, IDC_TINY12, m_Tiny[11]); and:- CStatic m_Tiny[12]; This appeared to work just fine until I came to edit another control using ClassWizard I then got the error:- Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]" I'm assuming this is VS telling me I have an entry in the DDX that it didn't put there even though it quite happily will compile and run it. So to the problem: Is having array elements in DDX entries a valid thing to do? If yes then how do I do it without the error? Thanks

        Apathy Rules - I suppose...

        Its not the things you fear that come to get you but all the things that you don't expect

        C Offline
        C Offline
        Chandrasekharan P
        wrote on last edited by
        #3

        put the above code after like this //}}AFX_DATA_MAP

        //}}AFX_DATA_MAP

        stevepqr wrote:

        DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
        DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
        DDX_Control(pDX, IDC_TINY3, m_Tiny[2]);
        .
        .
        .
        DDX_Control(pDX, IDC_TINY12, m_Tiny[11]);

        in DoDataExchange Function. It should work.

        C 1 Reply Last reply
        0
        • C Cedric Moonen

          stevepqr wrote:

          Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]"

          You forgot ");" at the end of the line. That's exactly what VS is telling you also :)

          Cédric Moonen Software developer
          Charting control [v2.0] OpenGL game tutorial in C++

          C Offline
          C Offline
          Chandrasekharan P
          wrote on last edited by
          #4

          cedric, i dont think he has forgotten to add the closing bracket because in the query where he is adding the control variable i can see the bracket being put properly.

          1 Reply Last reply
          0
          • C Cedric Moonen

            stevepqr wrote:

            Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]"

            You forgot ");" at the end of the line. That's exactly what VS is telling you also :)

            Cédric Moonen Software developer
            Charting control [v2.0] OpenGL game tutorial in C++

            C Offline
            C Offline
            Caslen
            wrote on last edited by
            #5

            Thanks for that but I forgot it from the post not the code! message actually reads:- Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]);" Sorry!

            1 Reply Last reply
            0
            • C Chandrasekharan P

              put the above code after like this //}}AFX_DATA_MAP

              //}}AFX_DATA_MAP

              stevepqr wrote:

              DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
              DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
              DDX_Control(pDX, IDC_TINY3, m_Tiny[2]);
              .
              .
              .
              DDX_Control(pDX, IDC_TINY12, m_Tiny[11]);

              in DoDataExchange Function. It should work.

              C Offline
              C Offline
              Caslen
              wrote on last edited by
              #6

              Thanks but the code is already included inside the '//}}AFX_DATA_MAP' I didn't change this part just added lines inside the markers.

              C 1 Reply Last reply
              0
              • C Caslen

                Thanks but the code is already included inside the '//}}AFX_DATA_MAP' I didn't change this part just added lines inside the markers.

                C Offline
                C Offline
                Chandrasekharan P
                wrote on last edited by
                #7

                i had the same problem and this was solved by adding the code outside the markers.

                1 Reply Last reply
                0
                • S stevepqr

                  VS6.0, C++ I have a control I need to 'interact' with, I set it up the usual way with ID = IDC_TINY1 and using ClassWizard to assign a variable CStatic m_Tiny1, as expected this gives me:- DDX_Control(pDX, IDC_TINY1, m_Tiny1); and in the header:- CStatic m_Tiny1; Now though I have 11 more identical controls and instead of having m_Tiny1, m_Tiny2, m_Tiny3 etc I think it would be better to have an array m_Tiny[12] but there seems to be no way to assign each element of the array using ClassWizard. So I decided to edit these entries manually to give me:- DDX_Control(pDX, IDC_TINY1, m_Tiny[0]); DDX_Control(pDX, IDC_TINY2, m_Tiny[1]); DDX_Control(pDX, IDC_TINY3, m_Tiny[2]); . . . DDX_Control(pDX, IDC_TINY12, m_Tiny[11]); and:- CStatic m_Tiny[12]; This appeared to work just fine until I came to edit another control using ClassWizard I then got the error:- Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]" I'm assuming this is VS telling me I have an entry in the DDX that it didn't put there even though it quite happily will compile and run it. So to the problem: Is having array elements in DDX entries a valid thing to do? If yes then how do I do it without the error? Thanks

                  Apathy Rules - I suppose...

                  Its not the things you fear that come to get you but all the things that you don't expect

                  O Offline
                  O Offline
                  Ozer Karaagac
                  wrote on last edited by
                  #8

                  ClassWizard only parses the lines inside its comments. You should place your custom lines outside the class wizard's special comments. Just below the comment line //}}AFX_DATA_MAP, for example.

                      CDialog::DoDataExchange(pDX);
                      //{{AFX_DATA_MAP(CYourDialogClassName)
                        // lines added by ClassWizard
                        // DDX_Control(...);
                        // DDX_Text(...);
                      //}}AFX_DATA_MAP
                      // lines added manually
                      DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
                      DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
                  

                  You should also take definitions into account in header file.

                      // Dialog Data
                      //{{AFX_DATA(CDlgFoo)
                      enum { IDD = IDD_DIALOG1 };
                      CStatic m_static1;
                      //}}AFX_DATA
                      CStatic m_Tiny[12];
                  

                  The lines added manually in that way, won't be parsed by ClassWizard.

                  C 1 Reply Last reply
                  0
                  • O Ozer Karaagac

                    ClassWizard only parses the lines inside its comments. You should place your custom lines outside the class wizard's special comments. Just below the comment line //}}AFX_DATA_MAP, for example.

                        CDialog::DoDataExchange(pDX);
                        //{{AFX_DATA_MAP(CYourDialogClassName)
                          // lines added by ClassWizard
                          // DDX_Control(...);
                          // DDX_Text(...);
                        //}}AFX_DATA_MAP
                        // lines added manually
                        DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
                        DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
                    

                    You should also take definitions into account in header file.

                        // Dialog Data
                        //{{AFX_DATA(CDlgFoo)
                        enum { IDD = IDD_DIALOG1 };
                        CStatic m_static1;
                        //}}AFX_DATA
                        CStatic m_Tiny[12];
                    

                    The lines added manually in that way, won't be parsed by ClassWizard.

                    C Offline
                    C Offline
                    Caslen
                    wrote on last edited by
                    #9

                    I thought of this already - when I try it I get 'Cannot Add New Member' when I try to add a new member but otherwise it works ok. I'm getting round this by commenting out the above lines adding new members and then uncommenting them, PITA!! :)

                    O 1 Reply Last reply
                    0
                    • C Caslen

                      I thought of this already - when I try it I get 'Cannot Add New Member' when I try to add a new member but otherwise it works ok. I'm getting round this by commenting out the above lines adding new members and then uncommenting them, PITA!! :)

                      O Offline
                      O Offline
                      Ozer Karaagac
                      wrote on last edited by
                      #10

                      The problem may be with .clw file. Close project then rename that file. ClassWizard will re-create it. Or you may edit yourself if you know what you do. :)

                      S 1 Reply Last reply
                      0
                      • O Ozer Karaagac

                        The problem may be with .clw file. Close project then rename that file. ClassWizard will re-create it. Or you may edit yourself if you know what you do. :)

                        S Offline
                        S Offline
                        stevepqr
                        wrote on last edited by
                        #11

                        Thanks! Deleting the .clw and regenerating it did the trick - strangely, after recreating it I had to exit VS and restart but now all is good. Thanks to everyone else too for their suggestions. :)

                        Apathy Rules - I suppose...

                        Its not the things you fear that come to get you but all the things that you don't expect

                        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