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. Disconnect data exchange

Disconnect data exchange

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
4 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.
  • W Offline
    W Offline
    Wim Engberts
    wrote on last edited by
    #1

    Hi to you all, In a Dialog, I use an Edit element to enter a key value for new objects. I use the same dialog somewhere else to select one of the objects and I then replace this CEdit element with a CComboBox from which the value can be selected. I would likt to use the same CString variable. In the current version, this CString is connected to the CEdit object in the DoDataExchange by a DDX_Text(pDX,.....). I would likt (in the OnInitDialog routine) to disconnect this CString from the CEdit element, and reconnect it (with a new DDX_Text probably) to the CComboBox element. Is there a way in which one can disconnect the data exchange? Or should I take the DDX_Text for this element out of DoDataExchange and put it in OnInitDialog altogether? Anyone have any suggestions? Thanks in advance William

    D 1 Reply Last reply
    0
    • W Wim Engberts

      Hi to you all, In a Dialog, I use an Edit element to enter a key value for new objects. I use the same dialog somewhere else to select one of the objects and I then replace this CEdit element with a CComboBox from which the value can be selected. I would likt to use the same CString variable. In the current version, this CString is connected to the CEdit object in the DoDataExchange by a DDX_Text(pDX,.....). I would likt (in the OnInitDialog routine) to disconnect this CString from the CEdit element, and reconnect it (with a new DDX_Text probably) to the CComboBox element. Is there a way in which one can disconnect the data exchange? Or should I take the DDX_Text for this element out of DoDataExchange and put it in OnInitDialog altogether? Anyone have any suggestions? Thanks in advance William

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Wim Engberts wrote:

      ...this CString is connected to the CEdit object...

      Use a CEdit member variable instead. For the combobox control, use a CComboBox member variable.


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      W 1 Reply Last reply
      0
      • D David Crow

        Wim Engberts wrote:

        ...this CString is connected to the CEdit object...

        Use a CEdit member variable instead. For the combobox control, use a CComboBox member variable.


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        W Offline
        W Offline
        Wim Engberts
        wrote on last edited by
        #3

        David, This is indeed what I do, however, I would like both controls to do their data exchange with the same CString variable, since I always show only one of the two (either the CEdit or the CComboBox), depending on the mode that I have selected for the dialog. I am now experimenting with a double DDX_Text in the DoDataExchange routine (referring both controls to the same CString). This compiles fine and it also seems to work properly. However, when starting the classwizard, I get an error. So far I have been able to go around this by putting the second DDX_Text outside of Microsoft's automatic data map (so putting it behind the "//}}AFX_DATA_MAP" line). So far, this seems to work properly. Regards, William

        D 1 Reply Last reply
        0
        • W Wim Engberts

          David, This is indeed what I do, however, I would like both controls to do their data exchange with the same CString variable, since I always show only one of the two (either the CEdit or the CComboBox), depending on the mode that I have selected for the dialog. I am now experimenting with a double DDX_Text in the DoDataExchange routine (referring both controls to the same CString). This compiles fine and it also seems to work properly. However, when starting the classwizard, I get an error. So far I have been able to go around this by putting the second DDX_Text outside of Microsoft's automatic data map (so putting it behind the "//}}AFX_DATA_MAP" line). So far, this seems to work properly. Regards, William

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          While ClassWizard is nice, do not let it ultimately govern how you lay out your code. It's meant to solve a problem a particular way, but that does not mean that other ways can't also be employed.


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          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