Click here to Skip to main content
15,895,782 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: "pDoc->SetTitle" problem Pin
Nelek31-May-07 6:31
protectorNelek31-May-07 6:31 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint31-May-07 16:06
Aint31-May-07 16:06 
GeneralRe: "pDoc->SetTitle" problem Pin
Nelek1-Jun-07 4:49
protectorNelek1-Jun-07 4:49 
GeneralRe: "pDoc->SetTitle" problem Pin
Rajkumar R31-May-07 19:07
Rajkumar R31-May-07 19:07 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint31-May-07 19:58
Aint31-May-07 19:58 
AnswerRe: "pDoc->SetTitle" problem [modified] Pin
Rajkumar R31-May-07 23:42
Rajkumar R31-May-07 23:42 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint3-Jun-07 23:59
Aint3-Jun-07 23:59 
AnswerOk, explaining better Pin
Nelek1-Jun-07 4:47
protectorNelek1-Jun-07 4:47 
Hi another time... I'm not going to copy the whole code another time, so open (in a new window) this link:

http://www.codeproject.com/script/comments/forums.asp?msg=2029429&forumid=1647&ForumID=1647&XtraIDs=1647&author=Nelek&sd=21%20Feb%202007&ed=22%20May%202007&stype=1&Page=3#xx2029429xx[^]

Now the explanations about every socket of code.

First: Declare the pDocTemplate.
I used it to have a different Menu to the new Views added, and to have the possibility to use the implementation of MFC about the views of the Document (GetFirstViewPosition and so on). I think this is clear, isn't it?

Second: CreateOrActivateNewFrame
These function has to be implemented in CMainFrm.cpp (and declared in the CMainFrm.h of course). What it makes is to look for kinds of the pDocTemplate that I give as first parameter and check out the second parameter (the name of the element of my project that owns the view) to know if a new frame has to be created or is already created and only need to set it active on the front.

Third: PreCreateWindow
This function is a MFC message already implemented in CChildFrm if you used the assistant... If not... no problem, make it by yourself is a standard MFC message. In this function what I make is to check if it is the MAIN (CScrollView) view or one secondary view (If the document doesn't exist and the m_szNewFrame has nothing in it... is the main one, otherwise a secondary). If it is the main, I leave the default configuration. If it is a secondary (CFormView) I check which of the three different types is, modify the size of the frame and FOR ALL secondary... I set the title of the new frame with cs.lpszName = pDoc->m_szNewFrameName; AND NOT using pDoc->SetTitle () (this only works for the main frame and all the descendents at the same time, not for a independant secondary frame).

Fourth: Using it
In my project I have 3 type of objects visibles in the view. When I make a double click I check if the click was in one of the already placed elements. If there is a match... then I take the name of the element, set the pDoc->m_szNewFrameName string with the element's name and some other things I want to have in the caption of the new window and use the function of the CMainFrame to CREATEorACTIVATE the new view passing the DocTemplate that I want for this specific element and the name of the element (who is going to have the intern ownership).

Fifth: Extras...
This was not written in the other message, but when I open the new CFormView I override the OnInitialUpdate to INMEDIATELY erase the content of pDoc->m_szNewFrameName string. This is to avoid conflicts and to be sure that the main window will have no problems if I choose to open a new document (that is a new CScrollView and all the necessary CFormViews). If you dont do it... then the new MainFrame will be limited to the values of the last CREATESTRUCT that you used...



I hope this time you have understood my explanation... and it works for you as well as for me.

Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

Question12 digit number calculation Pin
Ram Murali29-May-07 16:47
Ram Murali29-May-07 16:47 
AnswerRe: 12 digit number calculation Pin
Naveen29-May-07 17:01
Naveen29-May-07 17:01 
GeneralRe: 12 digit number calculation Pin
Ram Murali29-May-07 17:23
Ram Murali29-May-07 17:23 
GeneralRe: 12 digit number calculation Pin
Naveen29-May-07 17:33
Naveen29-May-07 17:33 
GeneralRe: 12 digit number calculation Pin
Ram Murali29-May-07 17:34
Ram Murali29-May-07 17:34 
QuestionQuestion about setting Directshow Filter properties Pin
godspeed12329-May-07 12:51
godspeed12329-May-07 12:51 
AnswerRe: Question about setting Directshow Filter properties Pin
Mark Salsbery29-May-07 14:07
Mark Salsbery29-May-07 14:07 
QuestionListview with LVS_ICON style Pin
Perspx29-May-07 12:41
Perspx29-May-07 12:41 
AnswerRe: Listview with LVS_ICON style Pin
Naveen29-May-07 15:03
Naveen29-May-07 15:03 
QuestionRedraw a pane splitter window Pin
gurucplusplus29-May-07 12:16
gurucplusplus29-May-07 12:16 
QuestionProblem on examing a String (token from a file) Pin
Immunity1829-May-07 9:39
Immunity1829-May-07 9:39 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow29-May-07 10:03
David Crow29-May-07 10:03 
AnswerRe: Problem on examing a String (token from a file) Pin
Immunity1829-May-07 20:57
Immunity1829-May-07 20:57 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 2:41
David Crow30-May-07 2:41 
AnswerRe: Problem on examing a String (token from a file) [modified] Pin
Immunity1830-May-07 2:48
Immunity1830-May-07 2:48 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 3:18
David Crow30-May-07 3:18 
AnswerRe: Problem on examing a String (token from a file) Pin
Immunity1830-May-07 3:19
Immunity1830-May-07 3:19 

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.