Click here to Skip to main content
15,910,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: switching between views in MDI Pin
Sakhalean7-Jul-10 1:07
Sakhalean7-Jul-10 1:07 
AnswerRe: switching between views in MDI Pin
Niklas L7-Jul-10 1:48
Niklas L7-Jul-10 1:48 
GeneralRe: switching between views in MDI Pin
Sakhalean7-Jul-10 1:56
Sakhalean7-Jul-10 1:56 
GeneralRe: switching between views in MDI Pin
Niklas L7-Jul-10 2:16
Niklas L7-Jul-10 2:16 
GeneralRe: switching between views in MDI Pin
Sakhalean7-Jul-10 2:26
Sakhalean7-Jul-10 2:26 
GeneralRe: switching between views in MDI Pin
Niklas L7-Jul-10 3:03
Niklas L7-Jul-10 3:03 
GeneralRe: switching between views in MDI Pin
Sakhalean7-Jul-10 3:19
Sakhalean7-Jul-10 3:19 
AnswerRe: switching between views in MDI Pin
Iain Clarke, Warrior Programmer7-Jul-10 21:22
Iain Clarke, Warrior Programmer7-Jul-10 21:22 
So, you have two problems...

When you click on the treeview node, you need to...

1/ open a view of the right type if it doesn't already exist.
2/ activate a view you've already created.

Are there multiple documents also?

Let's imagine this application:

A tree on the left. Parent nodes represent documents, and child nodes represent possible views. You can use CTreeCtrl::SetItemData to store a pointer to the CMyDocument at each parent node. And store a pointer (or NULL) for any CMyView objects in the child nodes.

The main trick is to make sure that closing a view sets the ItemData back to NULL in the views destructor.

Now it's just a case of being careful.

You can use a intermediate view class between CView and all your specialised view classes that do the book keeping so you only have to be careful in one place.

Good luck! Do let us know how it goes.

Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!

GeneralRe: switching between views in MDI Pin
Sakhalean8-Jul-10 19:34
Sakhalean8-Jul-10 19:34 
GeneralRe: switching between views in MDI Pin
Iain Clarke, Warrior Programmer8-Jul-10 20:39
Iain Clarke, Warrior Programmer8-Jul-10 20:39 
QuestionNeed help in hooking MS Office File Open/Save Dialog Pin
Dinakara K7-Jul-10 0:02
Dinakara K7-Jul-10 0:02 
QuestionMFC SDI popup menu Pin
alexander 19836-Jul-10 20:27
alexander 19836-Jul-10 20:27 
AnswerRe: MFC SDI popup menu Pin
Richard MacCutchan6-Jul-10 21:27
mveRichard MacCutchan6-Jul-10 21:27 
AnswerRe: MFC SDI popup menu Pin
Niklas L6-Jul-10 22:19
Niklas L6-Jul-10 22:19 
GeneralRe: MFC SDI popup menu Pin
alexander 19837-Jul-10 6:29
alexander 19837-Jul-10 6:29 
GeneralRe: MFC SDI popup menu Pin
Niklas L7-Jul-10 23:36
Niklas L7-Jul-10 23:36 
QuestionExpanding TreeNode in windows 7 Pin
rahul.kulshreshtha6-Jul-10 20:03
rahul.kulshreshtha6-Jul-10 20:03 
AnswerRe: Expanding TreeNode in windows 7 Pin
«_Superman_»6-Jul-10 20:28
professional«_Superman_»6-Jul-10 20:28 
GeneralRe: Expanding TreeNode in windows 7 Pin
rahul.kulshreshtha6-Jul-10 20:43
rahul.kulshreshtha6-Jul-10 20:43 
GeneralRe: Expanding TreeNode in windows 7 Pin
«_Superman_»6-Jul-10 20:59
professional«_Superman_»6-Jul-10 20:59 
GeneralRe: Expanding TreeNode in windows 7 Pin
rahul.kulshreshtha6-Jul-10 22:11
rahul.kulshreshtha6-Jul-10 22:11 
GeneralRe: Expanding TreeNode in windows 7 Pin
Niklas L6-Jul-10 22:14
Niklas L6-Jul-10 22:14 
GeneralRe: Expanding TreeNode in windows 7 Pin
rahul.kulshreshtha6-Jul-10 22:21
rahul.kulshreshtha6-Jul-10 22:21 
GeneralRe: Expanding TreeNode in windows 7 Pin
Niklas L6-Jul-10 22:30
Niklas L6-Jul-10 22:30 
AnswerRe: Expanding TreeNode in windows 7 Pin
David Crow7-Jul-10 3:45
David Crow7-Jul-10 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.