Home > Software engineering >  MFC document program how to dynamically loaded more different template document view
MFC document program how to dynamically loaded more different template document view

Time:09-19

Now I need to implement the following functions:
1, establish multiple document application based on CFORMVIEW class

Figure 1 wizard directly generated by the application (button4 I add on CFORMVIEW controls)

Figure 2 wizard generated resources
2, I create a CFORMVIEW, whose resources view below

Figure 3 new CFORMVIEW resources (for - button2 - button4 to add new CFORMVIEW controls)
3, I need to implement the following functions:
May click button4 in figure 2, dynamic open CFORMVIEW, in figure 3 (similar to the function of the menu bar of the "new" button to achieve, just create a new layer button in the menu bar is shown in figure 1 will always open the documents in the view class, now want to open the document view class in figure 3)
Concrete is a what kind of way of thinking, build new document template? And then how to call? In which class? CXXAPP class InitInstance () implementation program a run will appear CFORMVIEW selection dialog open?) Have the code better, can add words best WeChat chat, have small red envelopes and attended, ha ha, thank you all for the great god show me the novice,

CodePudding user response:

CXXAPP class default InitInstance () after creating a document template is not preserved, you can save and then direct call document template OpenDocumentFile (NULL), another button will, of course, but also mapping ID to your CXXAPP class so that you can access your saved document template,

CodePudding user response:

reference 1st floor Jiang Sheng response:
CXXAPP class default InitInstance () after creating a document template is not preserved, you can save and then direct call document template OpenDocumentFile (NULL), another button will, of course, but also mapping ID to your CXXAPP class so that you can access your saved document template,

My button4 how to map to the app in figure 1 in the class?

CodePudding user response:

refer to the second floor weixin_42203779 response:
Quote: refer to 1st floor Jiang Sheng response:
CXXAPP class default InitInstance () after creating a document template is not preserved, you can save and then direct call document template OpenDocumentFile (NULL), another button will, of course, but also mapping ID to your CXXAPP class so that you can access your saved document template,

My button4 how to map to the app in figure 1 in the class?

I just want to in the figure 1 button4 click once, then you can open a new document template classes, in the code of onbutton4 how to operate? Adddoctemplate (newdoctemplate); OpenDocumentFile (NULL); Like this?

CodePudding user response:

Just inside the InitInstance adddoctemplate, other places don't need
Said is adddoctemplate, after the doctemplate is preserved, do you want to save to a member variable to use after InitInstance,
As for how to Command Message forwarded to the app class, to search TN021: Command and Message Routing

CodePudding user response:

https://blog.csdn.net/VisualEleven/article/details/7010821
Hope to help you ~
  • Related