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. CEdit updates in dialog box

CEdit updates in dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionannouncement
3 Posts 3 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.
  • R Offline
    R Offline
    rpadrela
    wrote on last edited by
    #1

    I have a dialog box with several CEdit controls inside of it that are created dynamically during runtime, that dialog box sometimes is hidden and sometimes is not. When the dialog box is hidden for the first time, the 'strings' in the CEdit controls are saved into a data structure that i've defined, when the dialog is shown again i read the stores values previously and write them into the CEdit controls but this time the text inside of it is not the expected but it is the previous that was stored in there. I think there are some problems with updates. Since i'm new to MFC probably i need to do something to keep the CEdit controls update the text correctly. Any tip ? Thanks

    V P 2 Replies Last reply
    0
    • R rpadrela

      I have a dialog box with several CEdit controls inside of it that are created dynamically during runtime, that dialog box sometimes is hidden and sometimes is not. When the dialog box is hidden for the first time, the 'strings' in the CEdit controls are saved into a data structure that i've defined, when the dialog is shown again i read the stores values previously and write them into the CEdit controls but this time the text inside of it is not the expected but it is the previous that was stored in there. I think there are some problems with updates. Since i'm new to MFC probably i need to do something to keep the CEdit controls update the text correctly. Any tip ? Thanks

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      There are several solutions. One solution is SetWindowText(). Another solution is to add a CString member variable that corresponds to the editbox. Update the variable as a string and call UpdateData(false) to update the actual edit control. Kuphryn

      1 Reply Last reply
      0
      • R rpadrela

        I have a dialog box with several CEdit controls inside of it that are created dynamically during runtime, that dialog box sometimes is hidden and sometimes is not. When the dialog box is hidden for the first time, the 'strings' in the CEdit controls are saved into a data structure that i've defined, when the dialog is shown again i read the stores values previously and write them into the CEdit controls but this time the text inside of it is not the expected but it is the previous that was stored in there. I think there are some problems with updates. Since i'm new to MFC probably i need to do something to keep the CEdit controls update the text correctly. Any tip ? Thanks

        P Offline
        P Offline
        Peter Weyzen
        wrote on last edited by
        #3

        The unusual thing that you are doing, is not actually initializing the dialog -- that is creating it each time. So the 'normal' stuff that MFC does to transfer data from CString's <--> CEdit's is not getting done. I don't know the answer, but it has something to do with the DoDataExchange stuff that get's done when WM_INITDIALOG is handled. A possible hack would be to send your dialog the WM_INITDIALOG message??? (HACK ALERT!) Just a thought... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer Santa Cruz Networks

        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