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. How to get the CEdit box to update

How to get the CEdit box to update

Scheduled Pinned Locked Moved C / C++ / MFC
performancetutorialannouncement
3 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.
  • F Offline
    F Offline
    FredrickNorge
    wrote on last edited by
    #1

    I am making a autoupdater, using a CEdit text box to show a logg during the update progress, however only static_text and the progress bar updates as the tool runs the performed action, but only updates when the action is complete. this code is called on each update stage, progress bar in the code bellow updates as it should, but not the SetWindowText, untill the "update button" function is complete. void CAutoUpdaterDlg::OnBnClickedUpdate() { CEdit * s = static_cast(GetDlgItem(IDC_STATIC_MSG)); s->SetWindowText("Please wait, update in progress."); CButton *b = static_cast(GetDlgItem(IDC_UPDATE)); CButton *b2 = static_cast(GetDlgItem(IDCANCEL)); b2->EnableWindow(false); b->EnableWindow(false); sprintf(DynamicBuffer,"%s","Looking for updates...\n");OnUpdateScreen(); GetList(); // Downloads, test the list for readability // Read the file into memory file_LoadIntoMem("UpdateList.txt"); // Download the files read from the UpdateList sprintf(DynamicBuffer,"%s","Downloading new content in progress...\n"); OnUpdateScreen();GetTheFiles(); // After reading it into memory, delete it. CleanUp(); // Finaly enable the buttons again b->EnableWindow(true); b2->EnableWindow(true); s->SetWindowText(""); } void CAutoUpdaterDlg::OnUpdateScreen() { char LocalBuffer[10]; itter++; lineslimit++; sprintf(LocalBuffer, "%d", itter); CEdit * p = static_cast(GetDlgItem(IDC_Window)); // static message for now strcat(WindowBuffer, LocalBuffer); strcat(WindowBuffer, ": "); strcat(WindowBuffer, DynamicBuffer); int Size = strlen(WindowBuffer); p->SetMargins(5,5); p->SetWindowText(Convert_A_To_DA(WindowBuffer)); CProgressCtrl * progress = static_cast(GetDlgItem(IDC_PROGRESS)); progress->SetRange(0,MaxRange);Progress++; progress->SetPos(Progress); if (lineslimit == 11) { int size = strlen(WindowBuffer); for(int i = 0; i <= size+1; i++ ) { WindowBuffer[i] = 0x00; } lineslimit = 0; } int MemSize = sizeof(DynamicBuffer); for(int i = 0; i<= MemSize+1; i++) { DynamicBuffer[i] = 0x00; } }

    B 1 Reply Last reply
    0
    • F FredrickNorge

      I am making a autoupdater, using a CEdit text box to show a logg during the update progress, however only static_text and the progress bar updates as the tool runs the performed action, but only updates when the action is complete. this code is called on each update stage, progress bar in the code bellow updates as it should, but not the SetWindowText, untill the "update button" function is complete. void CAutoUpdaterDlg::OnBnClickedUpdate() { CEdit * s = static_cast(GetDlgItem(IDC_STATIC_MSG)); s->SetWindowText("Please wait, update in progress."); CButton *b = static_cast(GetDlgItem(IDC_UPDATE)); CButton *b2 = static_cast(GetDlgItem(IDCANCEL)); b2->EnableWindow(false); b->EnableWindow(false); sprintf(DynamicBuffer,"%s","Looking for updates...\n");OnUpdateScreen(); GetList(); // Downloads, test the list for readability // Read the file into memory file_LoadIntoMem("UpdateList.txt"); // Download the files read from the UpdateList sprintf(DynamicBuffer,"%s","Downloading new content in progress...\n"); OnUpdateScreen();GetTheFiles(); // After reading it into memory, delete it. CleanUp(); // Finaly enable the buttons again b->EnableWindow(true); b2->EnableWindow(true); s->SetWindowText(""); } void CAutoUpdaterDlg::OnUpdateScreen() { char LocalBuffer[10]; itter++; lineslimit++; sprintf(LocalBuffer, "%d", itter); CEdit * p = static_cast(GetDlgItem(IDC_Window)); // static message for now strcat(WindowBuffer, LocalBuffer); strcat(WindowBuffer, ": "); strcat(WindowBuffer, DynamicBuffer); int Size = strlen(WindowBuffer); p->SetMargins(5,5); p->SetWindowText(Convert_A_To_DA(WindowBuffer)); CProgressCtrl * progress = static_cast(GetDlgItem(IDC_PROGRESS)); progress->SetRange(0,MaxRange);Progress++; progress->SetPos(Progress); if (lineslimit == 11) { int size = strlen(WindowBuffer); for(int i = 0; i <= size+1; i++ ) { WindowBuffer[i] = 0x00; } lineslimit = 0; } int MemSize = sizeof(DynamicBuffer); for(int i = 0; i<= MemSize+1; i++) { DynamicBuffer[i] = 0x00; } }

      B Offline
      B Offline
      BlitzPackage
      wrote on last edited by
      #2

      Try using the UpdateData(...) function for the dialog before you referesh it's window or ask it to display something. If you call UpdateData(FALSE) it should write whatever you have in the SetWindowText(...) or value variable for that control onto the screen.

      F 1 Reply Last reply
      0
      • B BlitzPackage

        Try using the UpdateData(...) function for the dialog before you referesh it's window or ask it to display something. If you call UpdateData(FALSE) it should write whatever you have in the SetWindowText(...) or value variable for that control onto the screen.

        F Offline
        F Offline
        FredrickNorge
        wrote on last edited by
        #3

        UpdateWindow(); this function worked perfect, 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