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. Using CMFCStatusBar class How do you Set the Text for a Label(dynamically)

Using CMFCStatusBar class How do you Set the Text for a Label(dynamically)

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
18 Posts 6 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.
  • H Hamid Taebi

    Did you see CStatusBar::SetPaneText?

    L Offline
    L Offline
    Larry Mills Sr
    wrote on last edited by
    #3

    Yes that works! I don't know why I didn't see that command, but I'm glad you elightened me. Another question: Is there a way, to "on-the-fly",to enlarge a particular pane so that it fits the needed space for new text?

    A C++ programming language novice, but striving to learn

    L 1 Reply Last reply
    0
    • H Hamid Taebi

      Did you see CStatusBar::SetPaneText?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #4

      Hamid. wrote:

      Did you see CStatusBar::SetPaneText?

      They probably hide that in the documentation eh? Slimy bastards! They should be hung by their balls! :-D

      led mike

      M H 2 Replies Last reply
      0
      • L Larry Mills Sr

        Yes that works! I don't know why I didn't see that command, but I'm glad you elightened me. Another question: Is there a way, to "on-the-fly",to enlarge a particular pane so that it fits the needed space for new text?

        A C++ programming language novice, but striving to learn

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #5

        Larry Mills Sr wrote:

        I n't know why I didn't see that command

        Larry Mills Sr wrote:

        Is there a wait "on-the-fly" to enlarge a particular pane so that it fits the needed space for new text?

        Larry, 50 minutes has passed between your posts. It would take you less than 5 to go read the documentation on msnd.microsoft.com for the class. Logically it's more productive for you to read the documentation than wait for answers in internet forums. So the 50 cent question here is, why do you refuse to read the documentation?

        led mike

        L 1 Reply Last reply
        0
        • L led mike

          Larry Mills Sr wrote:

          I n't know why I didn't see that command

          Larry Mills Sr wrote:

          Is there a wait "on-the-fly" to enlarge a particular pane so that it fits the needed space for new text?

          Larry, 50 minutes has passed between your posts. It would take you less than 5 to go read the documentation on msnd.microsoft.com for the class. Logically it's more productive for you to read the documentation than wait for answers in internet forums. So the 50 cent question here is, why do you refuse to read the documentation?

          led mike

          L Offline
          L Offline
          Larry Mills Sr
          wrote on last edited by
          #6

          Okay, I checked out MSDN Lib rary on CStatusBar class. I found nothing explaining what command to enlarge the Pane for the new Text. Do you know where I can find that out?, or better still, what that command might be?

          A C++ programming language novice, but striving to learn

          L 1 Reply Last reply
          0
          • L led mike

            Hamid. wrote:

            Did you see CStatusBar::SetPaneText?

            They probably hide that in the documentation eh? Slimy bastards! They should be hung by their balls! :-D

            led mike

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #7

            led mike wrote:

            Slimy bastards! They should be hung by their balls!

            What makes you think they aren't already? :)

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            L 1 Reply Last reply
            0
            • L Larry Mills Sr

              Okay, I checked out MSDN Lib rary on CStatusBar class. I found nothing explaining what command to enlarge the Pane for the new Text. Do you know where I can find that out?, or better still, what that command might be?

              A C++ programming language novice, but striving to learn

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #8

              Larry Mills Sr wrote:

              Okay, I checked out MSDN Lib rary on CStatusBar class. I found nothing explaining what command to enlarge the Pane for the new Text. Do you know where I can find that out?, or better still, what that command might be?

              CStatusBar is not the same class as CMFCStatusBar.

              led mike

              1 Reply Last reply
              0
              • M Mark Salsbery

                led mike wrote:

                Slimy bastards! They should be hung by their balls!

                What makes you think they aren't already? :)

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                L Offline
                L Offline
                Larry Mills Sr
                wrote on last edited by
                #9

                I noticed in MSDN under CMFCStatusBar that there is a SetPaneWidth() but How do you set a particular Pane's width using that command. if my pane is ID_PANE3 how would I set the width on it to fit the length of a CString? (I sure wished they would show examples of this stuff.)

                A C++ programming language novice, but striving to learn

                C D L 3 Replies Last reply
                0
                • L Larry Mills Sr

                  I noticed in MSDN under CMFCStatusBar that there is a SetPaneWidth() but How do you set a particular Pane's width using that command. if my pane is ID_PANE3 how would I set the width on it to fit the length of a CString? (I sure wished they would show examples of this stuff.)

                  A C++ programming language novice, but striving to learn

                  C Offline
                  C Offline
                  Code o mat
                  wrote on last edited by
                  #10

                  CPane::AdjustSizeImmediate[^]

                  > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                  L C 2 Replies Last reply
                  0
                  • L led mike

                    Hamid. wrote:

                    Did you see CStatusBar::SetPaneText?

                    They probably hide that in the documentation eh? Slimy bastards! They should be hung by their balls! :-D

                    led mike

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #11

                    I am apprehensive for you why? because you flagrant their secrets of course I know you are a donor man. :-D

                    1 Reply Last reply
                    0
                    • L Larry Mills Sr

                      I noticed in MSDN under CMFCStatusBar that there is a SetPaneWidth() but How do you set a particular Pane's width using that command. if my pane is ID_PANE3 how would I set the width on it to fit the length of a CString? (I sure wished they would show examples of this stuff.)

                      A C++ programming language novice, but striving to learn

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

                      I find that using a function with various arguments uncovers a lot about its usage. Try something like:

                      mfcStatusBar.SetPaneWidth(ID_PANE3, 500);

                      "Love people and use things, not love things and use people." - Unknown

                      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                      L 2 Replies Last reply
                      0
                      • C Code o mat

                        CPane::AdjustSizeImmediate[^]

                        > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                        L Offline
                        L Offline
                        Larry Mills Sr
                        wrote on last edited by
                        #13

                        Yes I see that; but If my pane is ID_PANE3 how would I get focus on it and do this CPane::AdjustSizeImmediate() . How do I set the length(not Width) to equal(in pixels) to a CString? (An example would be great.)

                        A C++ programming language novice, but striving to learn

                        1 Reply Last reply
                        0
                        • C Code o mat

                          CPane::AdjustSizeImmediate[^]

                          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                          C Offline
                          C Offline
                          Code o mat
                          wrote on last edited by
                          #14

                          What i'd try is to call that on the MFCStatusBar itself with TRUE as parameter, so something like: my_mfc_statusbar.AdjustSizeImmediate(TRUE);

                          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                          1 Reply Last reply
                          0
                          • D David Crow

                            I find that using a function with various arguments uncovers a lot about its usage. Try something like:

                            mfcStatusBar.SetPaneWidth(ID_PANE3, 500);

                            "Love people and use things, not love things and use people." - Unknown

                            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                            L Offline
                            L Offline
                            Larry Mills Sr
                            wrote on last edited by
                            #15

                            Program crashed on that command David.

                            A C++ programming language novice, but striving to learn

                            H 1 Reply Last reply
                            0
                            • L Larry Mills Sr

                              I noticed in MSDN under CMFCStatusBar that there is a SetPaneWidth() but How do you set a particular Pane's width using that command. if my pane is ID_PANE3 how would I set the width on it to fit the length of a CString? (I sure wished they would show examples of this stuff.)

                              A C++ programming language novice, but striving to learn

                              L Offline
                              L Offline
                              led mike
                              wrote on last edited by
                              #16

                              Larry Mills Sr wrote:

                              I sure wished they would show examples of this stuff

                              They do, you just need to stop thinking that you will find a combined example for your specific needs.

                              Larry Mills Sr wrote:

                              How do you set a particular Pane's width

                              That is one specific thing which is clearly depicted in the documentation for the class.

                              Larry Mills Sr wrote:

                              the width on it to fit the length of a CString

                              Finding the pixel width of string is an entirely separate subject that there are examples for. If you stop looking for combined examples and learn to break your problems down to the individual parts and solve each of them you might find you are more successful in the field of Software Development.

                              Larry Mills Sr wrote:

                              using that command.

                              Also, stop using the word "command". Classes have methods, not commands. C libraries have functions, not commands. When you are using text based communications, applying the correct words is extremely helpful.

                              led mike

                              1 Reply Last reply
                              0
                              • D David Crow

                                I find that using a function with various arguments uncovers a lot about its usage. Try something like:

                                mfcStatusBar.SetPaneWidth(ID_PANE3, 500);

                                "Love people and use things, not love things and use people." - Unknown

                                "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                L Offline
                                L Offline
                                Larry Mills Sr
                                wrote on last edited by
                                #17

                                It crashed because the ID_PANE3 is not supposed to be there, rather the nIndex of the Pane is supposed to be there. Works okay if set to 250 rather than 500. Thanks David.

                                A C++ programming language novice, but striving to learn

                                1 Reply Last reply
                                0
                                • L Larry Mills Sr

                                  Program crashed on that command David.

                                  A C++ programming language novice, but striving to learn

                                  H Offline
                                  H Offline
                                  Hamid Taebi
                                  wrote on last edited by
                                  #18

                                  Please show your code?

                                  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