Change tool bar according to document
-
My project is about MDI with Multi-Document. In each document has it own menu and toolbar, it mean that the menu and toolbar must change according to activate child windows. For the menu,I use code below within InitInstance function to add document template then the menu (IDR_MSESoftTYPE and IDR_RECEIPT) can change according to activate child windows, so the menu already work fine.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MSESoftTYPE,
RUNTIME_CLASS(CMSESoftDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMSESoftView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);pDocTemplate = new CMultiDocTemplate(IDR\_RECEIPT, RUNTIME\_CLASS(CReceiptDoc), RUNTIME\_CLASS(CReceiptFrame), // custom MDI child frame RUNTIME\_CLASS(CReceiptView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); \* \* \*
What about the toolbar how can I make it like menu. Thanks
-
My project is about MDI with Multi-Document. In each document has it own menu and toolbar, it mean that the menu and toolbar must change according to activate child windows. For the menu,I use code below within InitInstance function to add document template then the menu (IDR_MSESoftTYPE and IDR_RECEIPT) can change according to activate child windows, so the menu already work fine.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MSESoftTYPE,
RUNTIME_CLASS(CMSESoftDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMSESoftView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);pDocTemplate = new CMultiDocTemplate(IDR\_RECEIPT, RUNTIME\_CLASS(CReceiptDoc), RUNTIME\_CLASS(CReceiptFrame), // custom MDI child frame RUNTIME\_CLASS(CReceiptView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); \* \* \*
What about the toolbar how can I make it like menu. Thanks
I can think of one "simple" solution: Don't have any main frame toolbars - but have them inside the childframe. You could also swap main toolbars in the childframes activate code, but that would be more fragile... I'd go for the first idea if I was you. Iain.
I have now moved to Sweden for love (awwww).