I'm trying to put a status bar on a dialog based app.
I have the following code in the OnInitDialog():
if (!m_wndStatusBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM) || !m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
else
MessageBox("Status bar created", "Debug");
// Show the status bar
m_wndStatusBar.EnableWindow(TRUE);
m_wndStatusBar.ShowWindow(SW_SHOW);
m_wndStatusBar.BringWindowToTop();
m_wndStatusBar.UpdateWindow();
if (!m_wndStatusBar.IsWindowVisible())
MessageBox("Status Bar not visible");
m_wndStatusBar.SetWindowText("Ready");
Here I get the message "Status bar created". This is good.
And I get the message "Status Bar not visible". This is expected since the Dialog is not yet visible.
Then I put a button on the dialog. This is the code for the button click.
// See if status bar is visible
if (!m_wndStatusBar.IsWindowVisible())
MessageBox("Status Bar is not visible");
else
MessageBox("Status Bar is visible");
CString PanelText = m_wndStatusBar.GetPaneText(2);
UINT PaneID;
UINT PaneStyle;
int PaneWidth;
m_wndStatusBar.GetPaneInfo(2, PaneID, PaneStyle, PaneWidth);
CString sStatusBarInfo;
sStatusBarInfo.Format("ID = %d\nStyle = %d\nWidth = %d\nPanelText = %s", PaneID, PaneStyle, PaneWidth, PanelText);
MessageBox(sStatusBarInfo);
When I click the button I get the message "Status Bar is visible". But I can't see it. And I get the message:
ID = 59138
Style = 0
Width = 25
PanelText = NUM
This says that the Status Bar is truly created and has a width. I don't know how to get the height info. But I believe the height is greater than 0. Where is that status bar?