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. Status Pane

Status Pane

Scheduled Pinned Locked Moved C / C++ / MFC
question
20 Posts 5 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.
  • T T RATHA KRISHNAN

    Yes, There are two status bar panes. I've called SetPaneInfo function after creating the Status Bar only. The code for displaying message in the status bar pane is, void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); } Here this line, CDC* pDC = m_wndStatusBar.GetDC(); compiles without any problem. This line also, pDC->SetTextAlign(TA_RIGHT); compiles without problem. But not displaying message right aligned. If I remove commenting from this line, //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); then only that exception occurs.

    P Offline
    P Offline
    prasad_som
    wrote on last edited by
    #11

    Show the code, how you have created this status bar ?

    Prasad Notifier using ATL | Operator new[],delete[][^]

    T 1 Reply Last reply
    0
    • P prasad_som

      Show the code, how you have created this status bar ?

      Prasad Notifier using ATL | Operator new[],delete[][^]

      T Offline
      T Offline
      T RATHA KRISHNAN
      wrote on last edited by
      #12

      The code for creating Status Bar is, if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; } Here is the Indicators. static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; IDS_MESSAGE is the ID of the second pane. The pane in which we display the message. ID_SHOWFPS is the ID of the First pane. I display the message in some other class using the following code. void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); }

      P K D 3 Replies Last reply
      0
      • T T RATHA KRISHNAN

        The code for creating Status Bar is, if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; } Here is the Indicators. static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; IDS_MESSAGE is the ID of the second pane. The pane in which we display the message. ID_SHOWFPS is the ID of the First pane. I display the message in some other class using the following code. void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); }

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #13

        T.RATHA KRISHNAN wrote:

        if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; }

        I'm seeing nothing wrong with your code, its creation is succesful. May be you mail send across your sample code ay prasad.som at mail dot com.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        T 1 Reply Last reply
        0
        • T T RATHA KRISHNAN

          Yes, There are two status bar panes. I've called SetPaneInfo function after creating the Status Bar only. The code for displaying message in the status bar pane is, void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); } Here this line, CDC* pDC = m_wndStatusBar.GetDC(); compiles without any problem. This line also, pDC->SetTextAlign(TA_RIGHT); compiles without problem. But not displaying message right aligned. If I remove commenting from this line, //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); then only that exception occurs.

          K Offline
          K Offline
          kasturi_haribabu
          wrote on last edited by
          #14

          I think its strange that one problem persists for such a long time... :sigh: I have some questions for you. 1. Have you used "SetIndicators" function? >> If you are not using function, your prograam will definitely crash. 2. What is the idea behind doing these operations in a DOC class? 3. Is it possible to share the code you are using to create status bars? thanks and regards haribabu

          T 1 Reply Last reply
          0
          • T T RATHA KRISHNAN

            The code for creating Status Bar is, if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; } Here is the Indicators. static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; IDS_MESSAGE is the ID of the second pane. The pane in which we display the message. ID_SHOWFPS is the ID of the First pane. I display the message in some other class using the following code. void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); }

            K Offline
            K Offline
            kasturi_haribabu
            wrote on last edited by
            #15

            If you call, m_wndStatusBar.SetPaneInfo(0, IDS_MESSAGE, SBPS_STRETCH, len); is program crashing?

            1 Reply Last reply
            0
            • K kasturi_haribabu

              I think its strange that one problem persists for such a long time... :sigh: I have some questions for you. 1. Have you used "SetIndicators" function? >> If you are not using function, your prograam will definitely crash. 2. What is the idea behind doing these operations in a DOC class? 3. Is it possible to share the code you are using to create status bars? thanks and regards haribabu

              T Offline
              T Offline
              T RATHA KRISHNAN
              wrote on last edited by
              #16

              Here is the indicators array. static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; The code that is used to create status bars. if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; } These two codes are in the same file only(MainFrm.cpp)

              1 Reply Last reply
              0
              • P prasad_som

                T.RATHA KRISHNAN wrote:

                if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; }

                I'm seeing nothing wrong with your code, its creation is succesful. May be you mail send across your sample code ay prasad.som at mail dot com.

                Prasad Notifier using ATL | Operator new[],delete[][^]

                T Offline
                T Offline
                T RATHA KRISHNAN
                wrote on last edited by
                #17

                Could U pls send me your correct email ID? (like this one rtr_18@yahoo.com)

                D 1 Reply Last reply
                0
                • T T RATHA KRISHNAN

                  Actually my requirement is to set width of the second pane only. I have told that first pane by mistake. My initial statement, m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_STRETCH,100); is the right requirement only. If I use this code, I got the afore mentioned exception.(refer last message by me).

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

                  T.RATHA KRISHNAN wrote:

                  Actually my requirement is to set width of the second pane only.

                  Do you have to use SetPaneInfo() to do this?


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • T T RATHA KRISHNAN

                    The code for creating Status Bar is, if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; } Here is the Indicators. static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; IDS_MESSAGE is the ID of the second pane. The pane in which we display the message. ID_SHOWFPS is the ID of the First pane. I display the message in some other class using the following code. void CPerspectiveDoc::OnShowMsg(CCmdUI* pCmdUI) { char str1[150]; //int len = message.GetLength(); sprintf(str1, "%s",message.GetString()); CDC* pDC = m_wndStatusBar.GetDC(); pDC->SetTextAlign(TA_RIGHT); pCmdUI->Enable(TRUE); //m_wndStatusBar.SetPaneInfo(1,IDS_MESSAGE,SBPS_NORMAL,100); pCmdUI->SetText((const char *)str1); //m_wndStatusBar.SetPaneInfo(1, IDS_MESSAGE, SBPS_STRETCH, len); }

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

                    T.RATHA KRISHNAN wrote:

                    static UINT indicators[] = { 0,// ID_SEPARATOR IDS_MESSAGE, ID_SHOWFPS, }; IDS_MESSAGE is the ID of the second pane.

                    Do you have an entry for IDS_MESSAGE in the stringtable resource?


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    1 Reply Last reply
                    0
                    • T T RATHA KRISHNAN

                      Could U pls send me your correct email ID? (like this one rtr_18@yahoo.com)

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

                      T.RATHA KRISHNAN wrote:

                      Could U pls send me your correct email ID?

                      It is correct.


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      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