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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Refresh of edit box, Timing issue?

Refresh of edit box, Timing issue?

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestion
7 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.
  • M Offline
    M Offline
    moobob
    wrote on last edited by
    #1

    I have 2 edit boxes, A & B. B cannot have a value in it unless A does. B is disabled until A gets a value. When the user erases the value in A, I want to disable and erase the value in B. This all works fine in the debugger with the following code: if (m_VidValue.IsEmpty()) { m_Prefix = ""; GetDlgItem(IDC_VID_PREFIX_EDIT)->EnableWindow(FALSE); UpdateData(FALSE); } When I run the code outside the debugger, the field gets disabled, but it does not clear. I can make it clear by forcing a RedrawWindow(). Is there a better way to do this without redrawing and getting the annoying flicker? Thanks in advance, Bob

    N 1 Reply Last reply
    0
    • M moobob

      I have 2 edit boxes, A & B. B cannot have a value in it unless A does. B is disabled until A gets a value. When the user erases the value in A, I want to disable and erase the value in B. This all works fine in the debugger with the following code: if (m_VidValue.IsEmpty()) { m_Prefix = ""; GetDlgItem(IDC_VID_PREFIX_EDIT)->EnableWindow(FALSE); UpdateData(FALSE); } When I run the code outside the debugger, the field gets disabled, but it does not clear. I can make it clear by forcing a RedrawWindow(). Is there a better way to do this without redrawing and getting the annoying flicker? Thanks in advance, Bob

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      You could try using SetWindowText("") to clear an edit box, for instance: m_Prefix = ""; CWnd *pControl = GetDlgItem(IDC_VID_PREFIX_EDIT); if(pControl) { pControl->SetWindowText(""); pControl->EnableWindow(FALSE); } No generalization is 100% true. Not even this one.

      M 1 Reply Last reply
      0
      • N Navin

        You could try using SetWindowText("") to clear an edit box, for instance: m_Prefix = ""; CWnd *pControl = GetDlgItem(IDC_VID_PREFIX_EDIT); if(pControl) { pControl->SetWindowText(""); pControl->EnableWindow(FALSE); } No generalization is 100% true. Not even this one.

        M Offline
        M Offline
        moobob
        wrote on last edited by
        #3

        SetWindowText does not work either, unless I do a RedrawWindow().

        N 1 Reply Last reply
        0
        • M moobob

          SetWindowText does not work either, unless I do a RedrawWindow().

          N Offline
          N Offline
          Navin
          wrote on last edited by
          #4

          Hmm, that seems odd. Are you doing the SetWindowText before you disable the window? You might be able to get away with a RedrawWindow only on the edit box, and not the whole dialog, which may help the flicker problem. No generalization is 100% true. Not even this one.

          M 1 Reply Last reply
          0
          • N Navin

            Hmm, that seems odd. Are you doing the SetWindowText before you disable the window? You might be able to get away with a RedrawWindow only on the edit box, and not the whole dialog, which may help the flicker problem. No generalization is 100% true. Not even this one.

            M Offline
            M Offline
            moobob
            wrote on last edited by
            #5

            Yes, I am doing the SetWindowText before I disable the window. I've also tried doing a RedrawWindow on the edit box, but that doesn't work.

            J 1 Reply Last reply
            0
            • M moobob

              Yes, I am doing the SetWindowText before I disable the window. I've also tried doing a RedrawWindow on the edit box, but that doesn't work.

              J Offline
              J Offline
              Jack Handy
              wrote on last edited by
              #6

              Did you try: GetDlgItem(IDC_VID_PREFIX_EDIT)->Invalidate(); -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.

              M 1 Reply Last reply
              0
              • J Jack Handy

                Did you try: GetDlgItem(IDC_VID_PREFIX_EDIT)->Invalidate(); -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.

                M Offline
                M Offline
                moobob
                wrote on last edited by
                #7

                That did it, thanks!

                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