Discussion:
How to customize MDI child frame without side effects
(too old to reply)
Mathew
2006-02-02 10:33:00 UTC
Permalink
Hi

I feel pretty stupid asking this but how do I customize an MDI Child
Frame title bar without side effects? I adding a
CChildFrame::OnUpdateFrameTitle and that looked good until I noticed I
was getting multiple active views. To check it wasn't something else I
had done I used a VS 2005 wizard to build a brand new MFC MDI
application, and added the following test code:

// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}

Sure enough, if I create multiple views, and switch between the windows
by clicking on them, I get into a situation where I have multiple active
window frames. If I comment out the SetWindowText line in the
OnUpdateFrameTitle above, I lose my custom window title but non-active
views have the correct inactive appearance. Actually, it's not the
whole window that incorrectly has the active appearance, it's just the
title bar. The rest of the window border has the inactive look.

I can send a picture to anyone who's interested.

What am I doing wrong?

Thanks in advance
Mathew

XP SP2 | VS 2005
Ajay Kalra
2006-02-03 04:51:34 UTC
Permalink
Post by Mathew
I feel pretty stupid asking this but how do I customize an MDI Child
Frame title bar without side effects? I adding a
CChildFrame::OnUpdateFrameTitle and that looked good until I noticed I
was getting multiple active views. To check it wasn't something else I
had done I used a VS 2005 wizard to build a brand new MFC MDI
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
That is odd. How about not calling the base class at all?

--
Ajay Kalra [MVP - VC++]
***@yahoo.com
Mathew
2006-02-03 10:24:29 UTC
Permalink
Hi
Post by Ajay Kalra
Post by Mathew
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
That is odd. How about not calling the base class at all?
Even without calling the base class I get the same problem. ie. With:

// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
//CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}

I still get multiple active MDI ChildFrame title bars.

Mathew
Ajay Kalra
2006-02-04 20:38:49 UTC
Permalink
Needless to say this is very odd. When I get time I will see if I can
reproduce this. I am assuming you are not doing any custom drawing of the
caption area.

--
Ajay Kalra [MVP - VC++]
Post by Mathew
Hi
Post by Ajay Kalra
Post by Mathew
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
That is odd. How about not calling the base class at all?
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
//CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
I still get multiple active MDI ChildFrame title bars.
Mathew
Mathew
2006-02-05 12:53:01 UTC
Permalink
Hi

No, no custom drawing. My test case is a wizard generated MDI MFC
application plus the void CChildFrame::OnUpdateFrameTitle(BOOL
bAddToTitle), nothing else.

Mathew
Post by Ajay Kalra
Needless to say this is very odd. When I get time I will see if I can
reproduce this. I am assuming you are not doing any custom drawing of the
caption area.
--
Ajay Kalra [MVP - VC++]
Post by Mathew
Hi
Post by Ajay Kalra
Post by Mathew
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
That is odd. How about not calling the base class at all?
// Called to update the window title
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
//CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
SetWindowText(_T("ABC"));
}
I still get multiple active MDI ChildFrame title bars.
Mathew
Loading...