Discussion:
MDI application - MDIMaximize
(too old to reply)
neilsolent
2011-12-13 08:50:11 UTC
Permalink
In my VC++ 6 MDI application, I am creating a new window with the code
below.
This seems to work fine, but If I comment out the call to MDIMaximize,
the window does not initialize properly.
I don't really want a maximized window though - what did I do wrong
that means I need to call this function?

thanks,
Neil


CCreateContext context;
context.m_pCurrentDoc = NULL;
context.m_pCurrentFrame = NULL;
context.m_pLastView = NULL;
context.m_pNewDocTemplate = NULL;
context.m_pNewViewClass = NULL;

CDynamicChildFrame* queryWnd = new CDynamicChildFrame;

CSplitterWnd* querySplitter = new CSplitterWnd;
queryWnd->Create(NULL, "New query", WS_CHILD | WS_OVERLAPPEDWINDOW,
CFrameWnd::rectDefault, this);

querySplitter->CreateStatic(queryWnd, 1, 2, WS_CHILD | WS_VISIBLE,
AFX_IDW_PANE_FIRST);

querySplitter->CreateView(0, 0, RUNTIME_CLASS(CQueryFormView),
CSize(350, 100), &context);
querySplitter->CreateView(0, 1, RUNTIME_CLASS(CReportResultsView),
CSize(10, 10), &context);

CQueryFormView* queryFormView = (CQueryFormView*) querySplitter-
GetPane(0, 0);
CReportResultsView* reportResultsView = (CReportResultsView*)
querySplitter->GetPane(0, 1);

doc->AddView(queryFormView);
doc->AddView(reportResultsView);

queryFormView->OnInitialUpdate();
reportResultsView->OnInitialUpdate();

MDIMaximize(queryWnd);

queryWnd->ModifyStyle(0, WS_VISIBLE);

querySplitter->SetActivePane(0, 0, NULL);
David Lowndes
2011-12-13 09:24:26 UTC
Permalink
Post by neilsolent
In my VC++ 6 MDI application, I am creating a new window with the code
below.
This seems to work fine, but If I comment out the call to MDIMaximize,
the window does not initialize properly.
Neil,

What precisely do you mean by "does not initialize properly"?

Dave
neilsolent
2011-12-13 10:27:04 UTC
Permalink
Post by David Lowndes
Neil,
What precisely do you mean by "does not initialize properly"?
Dave
The Window just has the outer frame, system menu and title. The
content is blank and not getting drawn / updated even when it is
covered/uncovered.
David Lowndes
2011-12-13 11:05:37 UTC
Permalink
Post by neilsolent
Post by David Lowndes
What precisely do you mean by "does not initialize properly"?
The Window just has the outer frame, system menu and title. The
content is blank and not getting drawn / updated even when it is
covered/uncovered.
That sounds really odd.

Do you have any code that runs as a result of maximising/resizing
(that doesn't happen when you omit the MDIMaximize call)?

What happens if you replace the MDIMaximize with MDIRestore?

Dave
neilsolent
2011-12-13 11:32:46 UTC
Permalink
Post by David Lowndes
Do you have any code that runs as a result of maximising/resizing
(that doesn't happen when you omit the MDIMaximize call)?
Don't think so, but I will investigate that.
Post by David Lowndes
What happens if you replace the MDIMaximize with MDIRestore?
I tried MDIRestore - doesn't make any difference.
Maybe this has something to do with being a splitter window and
something is not quite "linked" right
David Lowndes
2011-12-13 11:36:27 UTC
Permalink
Post by neilsolent
Post by David Lowndes
What happens if you replace the MDIMaximize with MDIRestore?
I tried MDIRestore - doesn't make any difference.
Weird.

Out of interest, how did you come to find that adding MDIMaximize had
a beneficial effect?
Post by neilsolent
Maybe this has something to do with being a splitter window and
something is not quite "linked" right
There must be something missing, but I don't know what it is.

Dave
neilsolent
2011-12-13 11:42:52 UTC
Permalink
Post by David Lowndes
Out of interest, how did you come to find that adding MDIMaximize had
a beneficial effect?
I actually wanted the window maximized at one point, but now I've
changed my mind I found it was actually needed to make the window work
at all!
neilsolent
2011-12-13 18:44:05 UTC
Permalink
I got it to work by replacing MDIMaximize with:

queryWnd->InitialUpdateFrame(doc, TRUE);
queryWnd->RecalcLayout(TRUE);

I am not sure whether this is "normal" or there is something "un-
natural" about my app -
but this solves it without any unwanted visual side-effects.

Loading...