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. why my CStatic doesn't show its text?

why my CStatic doesn't show its text?

Scheduled Pinned Locked Moved C / C++ / MFC
beta-testinghelpquestioncode-review
5 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.
  • L Offline
    L Offline
    lucy 0
    wrote on last edited by
    #1

    I have a modeless dialog, when one of its button is pressed, I called a subroutine to load a file. Since the operation is lengthy, I want to give user some feedback that sth is going on. So I want to show a text string. I did the following: CStatic textProgress; textProgress.Create(_T("Image loading..."), WS_CHILD | WS_VISIBLE|SS_CENTER, CRect(CPoint(rectDlg.left+nOffset, rectDlg.CenterPoint().y-2*nOffset), CSize(rectDlg.Width()-2*nOffset, nOffset)), pParent); but when the system runs, I saw the rectangle at the position specified, but no text. why? :confused: Thanks for any help!

    H 1 Reply Last reply
    0
    • L lucy 0

      I have a modeless dialog, when one of its button is pressed, I called a subroutine to load a file. Since the operation is lengthy, I want to give user some feedback that sth is going on. So I want to show a text string. I did the following: CStatic textProgress; textProgress.Create(_T("Image loading..."), WS_CHILD | WS_VISIBLE|SS_CENTER, CRect(CPoint(rectDlg.left+nOffset, rectDlg.CenterPoint().y-2*nOffset), CSize(rectDlg.Width()-2*nOffset, nOffset)), pParent); but when the system runs, I saw the rectangle at the position specified, but no text. why? :confused: Thanks for any help!

      H Offline
      H Offline
      Haakon S
      wrote on last edited by
      #2

      Try this instead of pParent. Haakon S. A sure cure for seasickness is to sit under a tree. Spike Milligan

      L 1 Reply Last reply
      0
      • H Haakon S

        Try this instead of pParent. Haakon S. A sure cure for seasickness is to sit under a tree. Spike Milligan

        L Offline
        L Offline
        lucy 0
        wrote on last edited by
        #3

        I don't have access to "this", since it's not a member function, but a global function. I also have a CProgressCtrl in this global function, it's being showed ok.

        K 1 Reply Last reply
        0
        • L lucy 0

          I don't have access to "this", since it's not a member function, but a global function. I also have a CProgressCtrl in this global function, it's being showed ok.

          K Offline
          K Offline
          khan
          wrote on last edited by
          #4

          Did you try updating the static control? Is this static control in another thread? If not then it needs to be repainted to show the text. like: mystatic.RedrawWindow() etc. this is this.

          L 1 Reply Last reply
          0
          • K khan

            Did you try updating the static control? Is this static control in another thread? If not then it needs to be repainted to show the text. like: mystatic.RedrawWindow() etc. this is this.

            L Offline
            L Offline
            lucy 0
            wrote on last edited by
            #5

            great! RedrawWindow() showed my text. Thanks a lot! :rose:

            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