Sherpa
asked on
switching between MDI child windows of different views
How can I programmatically switch between two open child windows (of different views) in a MDI application from CMainApp, the same way as it is done by selecting a window via the menu? (i.e. the corresponding window comes to the top, becomes active and has focus, etc...)
A kind of BringWindowToTop or SetWindowPos should make it, but it doesn't seem to work on MDI childs...
My documents and views are initialized in InitInstance as follows:
CMultiDocTemplate* pDocTemplate1;
pDocTemplate1 = new CMultiDocTemplate(
IDR_TYPE1,
RUNTIME_CLASS(CDoc1), // document 1
RUNTIME_CLASS(CChildFrame) , // custom MDI child frame
RUNTIME_CLASS(CView1)); // view 1
AddDocTemplate(pDocTemplat e1);
CMultiDocTemplate* pDocTemplate2;
pDocTemplate2 = new CMultiDocTemplate(
IDR_TYPE2,
RUNTIME_CLASS(CDoc2), // document 2
RUNTIME_CLASS(CChildFrame) , // custom MDI child frame
RUNTIME_CLASS(CView2)); // view 2
AddDocTemplate(pDocTemplat e2);
A kind of BringWindowToTop or SetWindowPos should make it, but it doesn't seem to work on MDI childs...
My documents and views are initialized in InitInstance as follows:
CMultiDocTemplate* pDocTemplate1;
pDocTemplate1 = new CMultiDocTemplate(
IDR_TYPE1,
RUNTIME_CLASS(CDoc1), // document 1
RUNTIME_CLASS(CChildFrame)
RUNTIME_CLASS(CView1)); // view 1
AddDocTemplate(pDocTemplat
CMultiDocTemplate* pDocTemplate2;
pDocTemplate2 = new CMultiDocTemplate(
IDR_TYPE2,
RUNTIME_CLASS(CDoc2), // document 2
RUNTIME_CLASS(CChildFrame)
RUNTIME_CLASS(CView2)); // view 2
AddDocTemplate(pDocTemplat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry, my fault :-)
I didn't explain my problem good enough...
I don't want to switch just to the next view, but to a (known) definite one among possibly many other open ones.
And I don't want to make a loop through all my open views to find the one I want to bring to top.
I didn't explain my problem good enough...
I don't want to switch just to the next view, but to a (known) definite one among possibly many other open ones.
And I don't want to make a loop through all my open views to find the one I want to bring to top.
ASKER
To MarkusLoibl:
Yes, unfortunately I really need to have two document templates...
Yes, unfortunately I really need to have two document templates...
I think, dynamically switching different views having the same document) is not a problem!