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. Resource file: Dialog copy

Resource file: Dialog copy

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studiohelptutorial
6 Posts 2 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.
  • L Offline
    L Offline
    ldaoust
    wrote on last edited by
    #1

    Using VS.NET 2003 VC++ MFC project. Having a problem with dialog resource copies. In VC6, I could insert a copy of an existing dialog and for which a class has been created, and then with the dialog editor I could add new controls on this copy and add event handler and variables for these new controls. In VC++.NET 2003 it does not seem to work. I can add a copy but after I add new controls on this dialog copy I cannot add events or variables to them because they are not listes in the Control Events in the properties page. Steps to reproduce: 1) create a dialog (default template will be enough) 2) Create a class for this dialog 3) Right the dialog in the resource view and select 'Insert Copy', you will have to enter a valuee in the condition field, for example 'TEMP' 4) Add an edit control to this copy of the dialog template Now, if you right click the edit control and select 'Add variable, the wizard will not have the proper control ID filled in. Also, if you go in the Properties of the dialog and select the Vontrol Events view, the ID for the edit control will not show up. I had no problem doing this in VS6. Anyone seen this problem and know a workaround ? Can anyone tell me if it does the same thing in VS.NET 2005 ? thanks.


    Louis * google is your friend *

    L 1 Reply Last reply
    0
    • L ldaoust

      Using VS.NET 2003 VC++ MFC project. Having a problem with dialog resource copies. In VC6, I could insert a copy of an existing dialog and for which a class has been created, and then with the dialog editor I could add new controls on this copy and add event handler and variables for these new controls. In VC++.NET 2003 it does not seem to work. I can add a copy but after I add new controls on this dialog copy I cannot add events or variables to them because they are not listes in the Control Events in the properties page. Steps to reproduce: 1) create a dialog (default template will be enough) 2) Create a class for this dialog 3) Right the dialog in the resource view and select 'Insert Copy', you will have to enter a valuee in the condition field, for example 'TEMP' 4) Add an edit control to this copy of the dialog template Now, if you right click the edit control and select 'Add variable, the wizard will not have the proper control ID filled in. Also, if you go in the Properties of the dialog and select the Vontrol Events view, the ID for the edit control will not show up. I had no problem doing this in VS6. Anyone seen this problem and know a workaround ? Can anyone tell me if it does the same thing in VS.NET 2005 ? thanks.


      Louis * google is your friend *

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      in 2005 after you copy the dialog into the resource tree you open it in the disigner, right click and choose the "Add Class" menu item. This brings up the dialog where you can add a class derived from CDialog bound to the dialog resource. After you do that adding controls and member variables work as expected. WARNING: Copy / Paste pattern is generally not a good development approach.

      "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum

      led mike

      Last modified: Friday, July 14, 2006 11:13:07 AM -- copy / paste warning

      L 1 Reply Last reply
      0
      • L led mike

        in 2005 after you copy the dialog into the resource tree you open it in the disigner, right click and choose the "Add Class" menu item. This brings up the dialog where you can add a class derived from CDialog bound to the dialog resource. After you do that adding controls and member variables work as expected. WARNING: Copy / Paste pattern is generally not a good development approach.

        "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum

        led mike

        Last modified: Friday, July 14, 2006 11:13:07 AM -- copy / paste warning

        L Offline
        L Offline
        ldaoust
        wrote on last edited by
        #3

        Hi led mike, My example was for a simple dialog. My situation, and I guess this is something many other programmers have to face, is that I have dialogs that already have a working class with all the code and variables and event handlers doing their stuff. Now, I am adding a copy for this same dialog to add features to it, so logically I will want to use the same code that is already there. The compile condition I add to the dialog copy makes it available only when I compile resources with this condition set. I can add code to the dialog that will also be conditionnaly compiled with the same condition. This makes adding new features to a dialog easy and also is more team friendly. You are suggesting to add a completly new class to the dialog. This would involve copying all the source from the other class to this new class and then adjusting the class name to match the new. If a modification is done to the original dialogs code (team) it will not be reflected in this class. Why a copy of a dialog resource would not be a good devcelopement approach ?


        Louis * google is your friend *

        L 1 Reply Last reply
        0
        • L ldaoust

          Hi led mike, My example was for a simple dialog. My situation, and I guess this is something many other programmers have to face, is that I have dialogs that already have a working class with all the code and variables and event handlers doing their stuff. Now, I am adding a copy for this same dialog to add features to it, so logically I will want to use the same code that is already there. The compile condition I add to the dialog copy makes it available only when I compile resources with this condition set. I can add code to the dialog that will also be conditionnaly compiled with the same condition. This makes adding new features to a dialog easy and also is more team friendly. You are suggesting to add a completly new class to the dialog. This would involve copying all the source from the other class to this new class and then adjusting the class name to match the new. If a modification is done to the original dialogs code (team) it will not be reflected in this class. Why a copy of a dialog resource would not be a good devcelopement approach ?


          Louis * google is your friend *

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          ldaoust wrote:

          so logically I will want to use the same code that is already there.

          I don't understand.

          ldaoust wrote:

          In VC6, I could insert a copy of an existing dialog and for which a class has been created, and then with the dialog editor I could add new controls on this copy and add event handler and variables for these new controls.

          When you copied the dialog resource how was the new dialog template associated to the existing class so that class wizard would create the variables for the controls etc.?

          "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
          Colin Angus Mackay in the C# forum

          led mike

          L 1 Reply Last reply
          0
          • L led mike

            ldaoust wrote:

            so logically I will want to use the same code that is already there.

            I don't understand.

            ldaoust wrote:

            In VC6, I could insert a copy of an existing dialog and for which a class has been created, and then with the dialog editor I could add new controls on this copy and add event handler and variables for these new controls.

            When you copied the dialog resource how was the new dialog template associated to the existing class so that class wizard would create the variables for the controls etc.?

            "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
            Colin Angus Mackay in the C# forum

            led mike

            L Offline
            L Offline
            ldaoust
            wrote on last edited by
            #5

            led mike wrote:

            I don't understand.

            I'm extending the functionality of a dialog. The class is already there. I am adding code to it. So the original dialog is bound to that class, i am working with that class.

            led mike wrote:

            When you copied the dialog resource how was the new dialog template associated to the existing class so that class wizard would create the variables for the controls etc.?

            The original dialog template was already associated with the class through the ID of the dialog. The dialog copy uses the same ID , only the condition changes, the association is still with the same class. This behaviour is the same with .NET 2003. If you make a copy of an exisiting dialog (Insert Copy as I described in my original post) and only change the condition, that copy will also be bound to the original class. Did you try it ?


            Louis * google is your friend *

            L 1 Reply Last reply
            0
            • L ldaoust

              led mike wrote:

              I don't understand.

              I'm extending the functionality of a dialog. The class is already there. I am adding code to it. So the original dialog is bound to that class, i am working with that class.

              led mike wrote:

              When you copied the dialog resource how was the new dialog template associated to the existing class so that class wizard would create the variables for the controls etc.?

              The original dialog template was already associated with the class through the ID of the dialog. The dialog copy uses the same ID , only the condition changes, the association is still with the same class. This behaviour is the same with .NET 2003. If you make a copy of an exisiting dialog (Insert Copy as I described in my original post) and only change the condition, that copy will also be bound to the original class. Did you try it ?


              Louis * google is your friend *

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              ldaoust wrote:

              Did you try it ?

              Yes in 2003 and with or without the preprocessor macro defined I only get the original dialog so the copied template never executes and controls added to the copied dialog resource never show up in the list of controls in the "add member variable" dialog. Never used this feature before today so I never saw it work in VC6.

              "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
              Colin Angus Mackay in the C# forum

              led mike

              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