Statusleiste für modalen Dialog als Hauptfenster



  • Hallo,
    ich habe eine Dialogbasierte Anwendung, in der ein modaler Dialog,
    als Hauptfenster dient.
    Diesem möchte ich nun eine Statusleiste (die unten bei Winows) hinzufügen.
    versucht habe ich schon:

    BOOL Cmvc_endtest_b1Dlg::OnInitDialog()
    {
    
      m_sb.CreateEx(this, SBARS_SIZEGRIP);
    m_sb.SetIndicators(indicators,sizeof(indicators) / sizeof(UINT));
    m_sb.SetPaneInfo(1, m_sb.GetItemID(1),SBPS_NORMAL, 130);
    
    m_sb.SetPaneInfo(1, m_sb.GetItemID(0),SBPS_STRETCH, NULL);
    m_sb.SetPaneText(1,"asdfsdf");
    m_sb.ShowWindow(SW_SHOW);
    

    Die Statusleiste erscheint natürlich nicht!

    Weiß jemand, wie das funktioniert?



  • Hallo
    Als erstes die Vaiable :
    CStatusBar m_bar;

    Dann die Konstanten
    static UINT BASED_CODE indicators[] =
    {
    ID_INDICATOR_NISH,
    ID_INDICATOR_TIME
    };

    und zum guten schluss das erstellen ...
    m_bar.Create(this); //We create the status bar

    m_bar.SetIndicators(indicators,2); //Set the number of panes

    CRect rect;
    GetClientRect(&rect);
    //Size the two panes
    m_bar.SetPaneInfo(0,ID_INDICATOR_NISH,
    SBPS_NORMAL,rect.Width()-100);
    m_bar.SetPaneInfo(1,ID_INDICATOR_TIME,SBPS_STRETCH ,0);

    //This is where we actually draw it on the screen
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,
    ID_INDICATOR_TIME);



  • ...Problem, die folgenden Indicatoren kennt mein System nicht. Stehen wohl nicht in den defines. Weißt Du zufällig die direkten hex-adressen. Benutze VC++ .net 2002.

    ID_INDICATOR_NISH,
    ID_INDICATOR_TIME
    


  • Lösung gefunden, und es klappt! 👍
    🙂 🙂 🙂
    Vielen Dank!

    http://www.codeproject.com/statusbar/dlgstatbar01.asp


Anmelden zum Antworten