Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtStatusbar and contained controls Collapse All
Subject Author Date
Jonas Gauffin Oct 5, 2006 - 2:58 AM

I have a CExtStatusBar with five different panes. One contains a CExtLabel with an icon, two contains a CExtLabel with text / different bk colors.
What should I do to get the statusbar to call ON_UPDATE_COMMAND_UI properly?

I’ve tried to Invalidate() both the CExtLabels and the statusbar, ON_UPDATE_COMMAND_UI isn’t called anyway. It’s only called when I drag the mouse over the main window.

Suhai Gyorgy Oct 5, 2006 - 4:38 AM

I have tried this updating with my simple statusbar, it works fine for me. Maybe my code helps, if you just forgot something:

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	...
	ON_UPDATE_COMMAND_UI(IDS_PANE_STATIC, OnStatusTest)
END_MESSAGE_MAP()
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	...
 
	if( !m_wndStatusBar.Create(this)
	   || !m_wndStatusBar.SetIndicators( indicators, sizeof(indicators) / sizeof(UINT) )
		)
	{ return -1; }
 
	// one CExtLabel in the statusbar
	m_pTimeLabel = new CExtLabel;
	if ( !m_pTimeLabel->Create(
			_T(""),
			WS_CHILD | WS_VISIBLE | SS_CENTER,
			CRect(0,0,0,0), 
			&m_wndStatusBar, 
			0)
		)
	{ return -1; }
	
	bool bRet = m_wndStatusBar.AddPane(IDS_PANE_STATIC, m_wndStatusBar.GetPaneCount());
	if (!bRet) return -1;
 
	int nIndex = m_wndStatusBar.CommandToIndex(IDS_PANE_STATIC);
	if (nIndex == -1) return -1;
	m_wndStatusBar.SetPaneWidth(nIndex, 90);
	m_wndStatusBar.SetPaneControl(m_pTimeLabel, IDS_PANE_STATIC, true);
 
	...
}
I get one call of OnStatusTest every second.