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 » CExtStatusControlBar Color SetPaneText Collapse All
Subject Author Date
Stephan Finkler Mar 3, 2005 - 1:57 AM

How can I change in idle pane the color of text and background?
Something like:

        int nIdlePaneIndex =
            m_wndStatusBar.CommandToIndex( 0 );
        if( nIdlePaneIndex != -1)
m_wndStatusBar.SetTextColor(nIdlePaneIndex, RGB(255,0,0)) // ????
m_wndStatusBar.SetBKColor(nIdlePaneIndex, RGB(0,0,255)) // ????
            m_wndStatusBar.SetPaneText( nIdlePaneIndex, strMessage );

Technical Support Mar 3, 2005 - 8:25 AM

Dear Stephan,

If you need to intercept the event that deals with displaying status tips for menu items and toolbar buttons, then let us first explain how status messages work in MFC.

The "idle pane" is more often called a message pane. If you send WM_SETMESSAGESTRING, which is an MFC internal message, to the frame window with specifying an identifier of some string resource in WPARAM, the frame will try to find the status bar by calling CFrameWnd::GetMessageBar(), load this string resource, and assign it to the status pane specified with zero identifier. This status pane identified with the zero value is called a message pane and it may be not the first pane or it may be absent altogether. If the value of WPARAM of the WM_SETMESSAGESTRING message is equal to AFX_IDS_IDLEMESSAGE, it is the standard "Ready" text that will be used as the text for this pane. That is how status messages work in the MFC framework.

By default, both Prof-UIS toolbars and menus do not work with the WM_SETMESSAGESTRING message used in MFC. The Prof-UIS framework gets the message text from the command manager. The status tip is described with the CExtCmdItem::m_sTipStatus variable. The algorithm is implemented in the CExtControlBar::stat_SetMessageString() method. So, to make the Prof-UIS framework work with the message pane in the status bar absolutely as it is done in MFC, you need to set the CExtControlBar::g_bUseCmdManagerForSetMessageString property to false. After that, you will be able to intercept the WM_SETMESSAGESTRING message in your main frame window and assign appropriate text to the message pane in the status bar.

If you assign new message text to the message pane somewhere at the beginning of some method, you need to reset the message string before you exit this method.

There are no SetTextColor() and SetBkColor() in the CExtStatusControlBar class nor in the CStatusBar and CStatusBarCtrl classes of MFC 4.2 that is distributed with Visual C++ 6.0. To manage colors in the status panes, create a CExtStatusControlBar-derived class and override the CExtStatusControlBar::OnPaintPane() virtual method. Your method can be based on that implemented in Prof-UIS (just modify its background painting). If you need to change the text color only, then override the ExtStatusControlBar::OnQueryPaneTextColor() and return the desired text color or COLORREF(-1L) value as the default enabled/disabled pane text color.