Re: How to modify the caption text for a MDI-application.
Ok here is the deal the only way I could accomplish this was to use OnSize
to detect when the child frame is maximizing and restoring, and depending on
that either set the title to blank or what we want to display. When the
window is maximizing we set the title to blank and when it is restoring set
it to show the title.
I am not 100% that it will work in all cases but worked ok while I played
with it.
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
if (nType == SIZE_MAXIMIZED)
{
SetWindowText("");
}
if (nType == SIZE_RESTORED || nType == SIZE_MINIMIZED)
{
SetWindowText("This is the view");
}
}
I tried to remove the FWS_ADDTOTITLE flag from the child frame after the
call to PreCreateWindow but what that did was competely remove the child
frames title, maximized or not. (seems a little wierd to me!)
Also you can keep your ChildFrame::OnUpdateFrameTitle(BOOL) method, in order
to set the title when the window comes up for the first time.
AliR.
<audiofilen@gmail.com> wrote in message
news:0f221e5c-ca9e-4adc-b725-72a839335169@v67g2000hse.googlegroups.com...
First I'd like to address the posted solution of many questions here
on this discussion group.
The solution would be to override OnUpdateFrameTitle and set whatever
title you would want.
I've tried this, both for the main frame and the childf rame and it
works - the title is changed for both, but for the mainframe reflects
the child frame depending on if it's maximized or not.
If the child frame is maximized this auto-magically shows in the main
frame caption even if I have overridden the main frame
OnUpdateFrameTitle.
What code is it that sets the main frame caption, when the child frame
is maximized, to "Main title - [Child title]" ?
How do I get rid of this?
My original problem was that my application have a caption that looks
like this: "Application - [Document]" but I want to reverse it to
"Document - Application". I added the FWS_PREFIXTITLE style to the
main frame and this did the trick, but only if the child frame is not
maximized.
Anyone got any good suggestions? :-)
Thanks
/Jonas