Diff between CreateNewFrame() and LoadFrame() for new views?
Posted on 1998-07-10
I have a document that contains data gathered from remote testers. It's not a file that the user can open. I have a view showing the data in text format in a grid. I want another view summarizing the data in a bar chart. Currently I am opening the new view's window by creating a doc template in InitInstance() like so:
// this done by class wizard:
pDocTemplate = new CMultiDocTemplate(
RUNTIME_CLASS(CChildFrame), // this frame has 'X' disabled, and other customizations
// my new template
m_pSummaryViewTemplate = new CMultiDocTemplate(
IDR_OVEN_SUMMARY, // refers only to a string resource, not a menu or icon
Then I open the frame from a menu handler with CDocTemplate::CreateNewFrame per the CHKBOOK sample or Blaszczak pg 196. This is working with some caveats, see below.
I understand I could also creat a new view/frame using LoadFrame() and a CCreateContext object. What's the difference? Which is the better route? A timer running in the main view should do an UpdateAllViews() when it trips.
The caveats mentioned above are 1) My summary frame title is the same as my CHostView frame, not the one I thought would be referenced by my IDR_OVEN_SUMMARY string, and 2) I want both child windows to have the same menu options, and MFC is greying out the ones it thinks my summary shouldn't have. The VIEWEX sample seemed to do what I was doing, but its menus are the same for both views. I do NOT want to maintain 2 menus like they did in CHKBOOK.
Thanks for your help on this,