Click here to Skip to main content
15,915,860 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: <fstream> Pin
Rage4-Jun-02 7:11
professionalRage4-Jun-02 7:11 
GeneralRe: &lt;fstream&gt; Pin
Rama Krishna Vavilala4-Jun-02 7:24
Rama Krishna Vavilala4-Jun-02 7:24 
GeneralRe: <fstream> Pin
Matt Newman4-Jun-02 7:49
Matt Newman4-Jun-02 7:49 
GeneralRe: <fstream> Pin
dazinith4-Jun-02 7:38
dazinith4-Jun-02 7:38 
GeneralRe: <fstream> Pin
Rama Krishna Vavilala4-Jun-02 7:49
Rama Krishna Vavilala4-Jun-02 7:49 
GeneralRe: <fstream> Pin
Matt Newman4-Jun-02 7:58
Matt Newman4-Jun-02 7:58 
GeneralDAO and Visual Studio .NET Pin
4-Jun-02 7:01
suss4-Jun-02 7:01 
GeneralMultiple view of a doc in MDI Pin
4-Jun-02 6:47
suss4-Jun-02 6:47 
I have got a MDI application. Now I want to add a view to a document apart from the one that is given to me by the wizard. I have inserted a menu File->SwitchView where I want to give a different view of the same data in the doc. Below is my code for handling 'Switch View' but seems like its not working. Will you please let me know what wrong I am doing.

void CMainFrame::OnFileSwitchview()
{
// TODO: Add your command handler code here
CView* pViewAdd = NULL;
CView* pViewRemove = NULL;
CDocument* pDoc = GetActiveFrame()->GetActiveDocument();
if (m_pView == NULL)
{
m_pView = new CNewView();
m_pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,rectDefault, GetActiveFrame(), AFX_IDW_PANE_FIRST + 1, NULL);
pViewAdd = m_pView;
pViewRemove = GetActiveFrame()->GetActiveView();
}
int nSwitchChildID = pViewAdd->GetDlgCtrlID();
pViewAdd->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
pViewRemove->SetDlgCtrlID(nSwitchChildID);

pViewAdd->ShowWindow(SW_SHOW);
pViewRemove->ShowWindow(SW_HIDE);

// Connect the newly active view to the document, and
// disconnect the inactive view.
pDoc->AddView(pViewAdd);
pDoc->RemoveView(pViewRemove);

GetActiveFrame()->SetActiveView(pViewAdd);
RecalcLayout();
}

m_pView is the one I am trying to view.

Thanks in advance. Looking fwd to a solution. BTW I know the way it is to be handled in SDI.. its the MDI which is giving the trouble.

Thanks again,

Sudip
GeneralRe: Multiple view of a doc in MDI Pin
Ed Gadziemski4-Jun-02 14:26
professionalEd Gadziemski4-Jun-02 14:26 
Generalgc struct/class Help Pin
Paul Watson4-Jun-02 6:49
sitebuilderPaul Watson4-Jun-02 6:49 
GeneralRe: gc struct/class Help Pin
Rama Krishna Vavilala4-Jun-02 7:03
Rama Krishna Vavilala4-Jun-02 7:03 
GeneralRe: gc struct/class Help Pin
Paul Watson4-Jun-02 21:50
sitebuilderPaul Watson4-Jun-02 21:50 
GeneralRe: gc struct/class Help Pin
Anders Molin4-Jun-02 9:31
professionalAnders Molin4-Jun-02 9:31 
GeneralRe: gc struct/class Help Pin
4-Jun-02 9:33
suss4-Jun-02 9:33 
GeneralRe: gc struct/class Help Pin
Paul Watson4-Jun-02 21:58
sitebuilderPaul Watson4-Jun-02 21:58 
GeneralThe thing is in the tree Pin
Rage4-Jun-02 6:22
professionalRage4-Jun-02 6:22 
GeneralRe: The thing is in the tree Pin
4-Jun-02 11:18
suss4-Jun-02 11:18 
GeneralRe: The thing is in the tree Pin
Rage4-Jun-02 21:18
professionalRage4-Jun-02 21:18 
GeneralRe: The thing is in the tree Pin
4-Jun-02 21:29
suss4-Jun-02 21:29 
GeneralThread blocking interface Pin
Hans Ruck4-Jun-02 6:17
Hans Ruck4-Jun-02 6:17 
GeneralRe: Thread blocking interface Pin
Tomasz Sowinski4-Jun-02 6:41
Tomasz Sowinski4-Jun-02 6:41 
GeneralRe: Thread blocking interface Pin
Hans Ruck4-Jun-02 6:43
Hans Ruck4-Jun-02 6:43 
GeneralRe: Thread blocking interface Pin
Tomasz Sowinski4-Jun-02 6:48
Tomasz Sowinski4-Jun-02 6:48 
GeneralRe: Thread blocking interface Pin
Hans Ruck4-Jun-02 7:09
Hans Ruck4-Jun-02 7:09 
GeneralSingle document in MDI Pin
Haakon S.4-Jun-02 6:14
Haakon S.4-Jun-02 6:14 

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.