Click here to Skip to main content
16,005,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Changing dialog style Pin
Chopper8-Apr-03 1:04
Chopper8-Apr-03 1:04 
GeneralRe: Changing dialog style Pin
Joan M8-Apr-03 3:16
professionalJoan M8-Apr-03 3:16 
GeneralRe: Changing dialog style Pin
Chopper8-Apr-03 3:22
Chopper8-Apr-03 3:22 
GeneralRe: Changing dialog style Pin
Joan M8-Apr-03 3:25
professionalJoan M8-Apr-03 3:25 
GeneralRe: Changing dialog style Pin
Joan M8-Apr-03 3:51
professionalJoan M8-Apr-03 3:51 
GeneralGetting system font Pin
puzzolino7-Apr-03 21:55
puzzolino7-Apr-03 21:55 
GeneralRe: Getting system font Pin
dysxq8-Apr-03 4:13
dysxq8-Apr-03 4:13 
GeneralMultiple Views in a SDI project Pin
Anonymous7-Apr-03 21:34
Anonymous7-Apr-03 21:34 
I know that in and SDI project normally exists only
a DOC and a VIEW at the same time.
I need to develop a project where I can change some
different views for the same document in order to manage
a not easy UI (lots of controls...).
In this way... I have found the following function:

BOOL CMysDoc::SwitchToView(CRuntimeClass* pNewViewClass)
{
CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
CView* pOldActiveView = pMainWnd->GetActiveView();

// If we're already displaying this kind of view, no need to go further.
if (pOldActiveView->IsKindOf(pNewViewClass))
return TRUE;

// Set the child window ID of the active view to AFX_IDW_PANE_FIRST.
// This is necessary so that CFrameWnd::RecalcLayout will allocate
// this "first pane" to that portion of the frame window's client
// area not allocated to control bars. Set the child ID of
// the previously active view to some other ID.
::SetWindowLong(pOldActiveView->m_hWnd, GWL_ID, 0);

// create the new view
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = this;
CView* pNewView = STATIC_DOWNCAST(CView, pMainWnd->CreateView(&context));
if (pNewView != NULL)
{
// the new view is there, but invisible and not active...
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
pMainWnd->SetActiveView(pNewView);
pMainWnd->RecalcLayout();

// destroy the old view...
pOldActiveView->DestroyWindow();
pOldActiveView = NULL;
return TRUE;
}
return FALSE;
}


Using this function I can easily change the current View
but at least one problem remains...
This function destroyes the old view so in my application
exists only one view at the same time.
This causes the not-possibility to centralize Views management.
I'd like to create all views at the start of my application
and to manage all of them in the same time (showing
only one and changing the visualized one when is required).
Is it possible to do that ??
Or only one view can exixts in the SDI project ??

I have also tried to use a sequence of the following instructions
in order to create all views at the start of the application:

// create the new view
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = this;
CView* pNewView = STATIC_DOWNCAST(CView, pMainWnd->CreateView(&context));


But it seems to doesn't work !!!

Can someone help me ??
Thanks a lot !!
GeneralRe: Multiple Views in a SDI project Pin
Cedric Moonen7-Apr-03 21:44
Cedric Moonen7-Apr-03 21:44 
GeneralDevice units to Pixels Pin
Ernesto D.7-Apr-03 21:16
Ernesto D.7-Apr-03 21:16 
GeneralRe: Device units to Pixels Pin
Martyn Pearson7-Apr-03 21:39
Martyn Pearson7-Apr-03 21:39 
GeneralRe: Device units to Pixels Pin
puzzolino7-Apr-03 21:44
puzzolino7-Apr-03 21:44 
GeneralReplace Data in file Pin
Cedric Moonen7-Apr-03 20:36
Cedric Moonen7-Apr-03 20:36 
GeneralRe: Replace Data in file Pin
csc7-Apr-03 21:40
csc7-Apr-03 21:40 
GeneralRe: Replace Data in file Pin
Martyn Pearson7-Apr-03 21:43
Martyn Pearson7-Apr-03 21:43 
GeneralRe: Replace Data in file Pin
Cedric Moonen7-Apr-03 22:07
Cedric Moonen7-Apr-03 22:07 
GeneralFile search problem Pin
RaajaOfSelf7-Apr-03 20:19
RaajaOfSelf7-Apr-03 20:19 
GeneralRe: File search problem Pin
Martyn Pearson7-Apr-03 21:46
Martyn Pearson7-Apr-03 21:46 
GeneralRe: File search problem Pin
csc7-Apr-03 21:57
csc7-Apr-03 21:57 
QuestionHow to get vector single line font as in AutoCAD???How to use it?? Pin
Jon_Hu7-Apr-03 18:49
Jon_Hu7-Apr-03 18:49 
GeneralOpenGL vs. Direct3d Pin
snood7-Apr-03 18:29
snood7-Apr-03 18:29 
GeneralRe: OpenGL vs. Direct3d Pin
puzzolino7-Apr-03 21:22
puzzolino7-Apr-03 21:22 
GeneralRe: OpenGL vs. Direct3d Pin
Roger Allen8-Apr-03 1:36
Roger Allen8-Apr-03 1:36 
General2 questions Pin
Stan the man7-Apr-03 17:11
Stan the man7-Apr-03 17:11 
GeneralRe: 2 questions Pin
Dave Bryant7-Apr-03 17:32
Dave Bryant7-Apr-03 17:32 

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.