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 Tech Support » StatusBar in ChildWindow Collapse All
Subject Author Date
Christoph Luedi Apr 13, 2007 - 2:53 PM

I want to have a status bar in my MDI child frame windows which should be of fixed width. If I use the OnGetMinMaxInfo() method, the window with remains constant indeed, but the status bar is still following the cursor and resized. How can I implement this? My code fragments are below. Thanks!

// class definition
CChildFrame : public CExtNCW < CMDIChildWnd >
{
//...
CExtStatusControlBar m_wndStatusBar;
// ...
afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
// ...
};


// method implementation
void CChildFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
CExtNCW<CMDIChildWnd>::OnGetMinMaxInfo(lpMMI);
lpMMI->ptMinTrackSize.x = 510;
lpMMI->ptMinTrackSize.y = 150;
lpMMI->ptMaxTrackSize.x = 510;
}

Christoph Luedi Apr 14, 2007 - 5:09 PM

One additional note: The problem only exists for Office 2007 themes, with all other themes it is displayed OK!

Technical Support Apr 15, 2007 - 11:07 AM

By default, the status bar is a bottom-aligned, non-redockable control bar which takes up the entire width of its parent window. The status bar as a child of the frame window should always be always correctly because any kind of frame window invokes CFrameWnd::RecalcLayout() which makes all control bars take their correct positions. The control bars may have incorrect layout if you somehow intercept the WM_SIZE message sent to the frame window and do not invoke the parent class’s method. The most often case is an incorrect layout of control bars at startup only and if you place RecalcLayout() at the end of OnCreate(), that should fix the problem. In any case, the control bars’ layout does not relate to the currently installed paint manager in Prof-UIS, except for the following case which really can be the source of the problem: the WM_GETMINMAXINFO message is completely handled by the CExtNCW::WindowProc() virtual method if the paint manager implements skinned non-client window areas. So, we guess if you handle this message in the CChildFrame::WindowProc() virtual method before invoking the CExtNCW < CMDIChildWnd > :: WindowProc() parent class method, that may fix the problem.

Christoph Luedi Apr 16, 2007 - 11:16 AM

I’m not sure if I understand you correctly - "is handled", do you mean that I have to resize ("handle") the contol bar manually to the constant width before calling the (useless) parent class method CExtNCW < CMDIChildWnd > :: WindowProc()?

To avoid misunderstandings, here is the compact problem description: If then an Office 2007 theme is used in combination with a OnGetMinMaxInfo() handler, the status bar does not consider the minmax info, but the child frame window does.

It seems that there is no overridden OnGetMinMaxInfo() function at all since _AFXWIN_INLINE void CWnd::OnGetMinMaxInfo(MINMAXINFO*) { Default(); } is called in my debugger if the last line of the code below is executed:

void CChildFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
lpMMI->ptMinTrackSize.x = 500;
lpMMI->ptMaxTrackSize.x = 500;

CExtNCW<CMDIChildWnd>::OnGetMinMaxInfo(lpMMI);
}

So does this mean that I have to resize the StatusBar manually or am I missing something else?

Thanks for your patience, helping me with my problem.

Technical Support Apr 16, 2007 - 12:47 PM

Please remove the OnGetMinMaxInfo() handler method and ON_WM_GETMINMAXINFO message map entry from the CChildView class. Then add the WindowProc() virtual method into this class:

LRESULT CChildView::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CMDIChildWnd > :: WindowProc( message, wParam, lParam );
      if( message == WM_GETMINMAXINFO )
      {
            LPMINMAXINFO pMMI = (LPMINMAXINFO)lParam;
            ASSERT( pMMI != NULL );
            pMMI->ptMinTrackSize.x = 500;
            pMMI->ptMaxTrackSize.x = 500;
      }
      return lResult;
}


Offer Har Apr 17, 2007 - 1:05 PM

Dear Support,

Is CExtNCW safe to use in a child-window?
In the past it generated some weird behavior to the child windows.

Thanks,
Ron.

Technical Support Apr 18, 2007 - 11:40 AM

The CExtNCW template class is not designed for child controls at all. It is designed for windows with caption and borders. It is not a kind of universal non-client area replacement for everything.

Offer Har Apr 18, 2007 - 1:49 PM

This is from you reply in the thread:

LRESULT CChildView::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = CExtNCW < CMDIChildWnd > :: WindowProc( message, wParam, lParam );
if( message == WM_GETMINMAXINFO )
{
LPMINMAXINFO pMMI = (LPMINMAXINFO)lParam;
ASSERT( pMMI != NULL );
pMMI->ptMinTrackSize.x = 500;
pMMI->ptMaxTrackSize.x = 500;
}
return lResult;
}

This is why I am asking.
A while ago you said that this feature is in you todo list, because what happens now is even if the application is themed, in MDI you still get the XP frames when MDI window is not maximized.

Regards,
Ron.