15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dynamic SubViews

Riso Nemec -- nemec@softec.softec.sk
Monday, July 08, 1996

ENV: VC++ 4.0 / Win95

Dear experts!

Standard MFC model directly supports Document-View model 1:N.
Sometimes we need to show in a View of a document also attributes (generally 
View) of associated Document.
WE DO NOT WANT TO DO IT DIRECTLY IN THAT VIEW.
We want to realize such a diagram:
          -------------------
          | Class1BasicView |
          -------------------
                   |      |
                   |     ---------------
                   |     |  Class2View |
                   |     ---------------
                   |                |
              -----------          ----------
              |  Class1 |  ------> | Class2 |
              -----------          ----------
where Class1 has a pointer to an instance of a class Class2 (or of a 
subclass of Class2 !!!).

1) We want to leave the drawing, updates etc to classes Class2 and 
   Class2View (using powerfull Document-View updating mechanism).
2) We want to dynamically fill the corresponding subview (when the 
   associated object is of Class3 - subclass of Class2, it has its own 
   Class3View) with the view of actual associated object.
3) Splitted Window is insufficient - we need to place subview area at any 
   place, possibly many subviews.

If you have any suggestions on correct (and effective) methods doing this 
(preferably), or 3rd-party library (less preferably) or arguments why it's 
impossible (I don't want to hear about it! :-), respond to this mailing list 
or by mail to (nemec@softec.sk).

Or does somewhere exist a CViewCtrl?

THANK YOU!

-- 
  ___  ___  ____ _   ____________________________________________________
 / __)/   \|    ) |  Richard NEMEC, SOFTEC, Bratislava, Slovakia, Europe
(___ \  |  \   (| |  phone:  +42-7-273805
(_____)____/_|\_\_|  e-mail: nemec@softec.sk
 ____ _  ___  ___    www:    -- N/A --
|    ) |/ __)/   \   hobby:  iveta@home.dnv.sk
|   (| |___ \  |  \  ...:    ???
|_|\_\_|_____)____/  ____________________________________________________



Riso Nemec -- nemec@softec.softec.sk
Thursday, July 11, 1996

ENV: VC++ 4.0 / Win95

Dear experts!

Standard MFC model directly supports Document-View model 1:N.
Sometimes we need to show in a View of a document also attributes (generally 
View) of associated Document.
WE DO NOT WANT TO DO IT DIRECTLY IN THAT VIEW.
We want to realize such a diagram:
          -------------------
          | Class1BasicView |
          -------------------
                   |      |
                   |     ---------------
                   |     |  Class2View |
                   |     ---------------
                   |                |
              -----------          ----------
              |  Class1 |  ------> | Class2 |
              -----------          ----------
where Class1 has a pointer to an instance of a class Class2 (or of a 
subclass of Class2 !!!).

1) We want to leave the drawing, updates etc to classes Class2 and 
   Class2View (using powerfull Document-View updating mechanism).
2) We want to dynamically fill the corresponding subview (when the 
   associated object is of Class3 - subclass of Class2, it has its own 
   Class3View) with the view of actual associated object.
3) Splitted Window is insufficient - we need to place subview area at any 
   place, possibly many subviews.

If you have any suggestions on correct (and effective) methods doing this 
(preferably), or 3rd-party library (less preferably) or arguments why it's 
impossible (I don't want to hear about it! :-), respond to this mailing list 
or by mail to (nemec@softec.sk).

Or does somewhere exist a CViewCtrl?

THANK YOU!

-- 
  ___  ___  ____ _   ____________________________________________________
 / __)/   \|    ) |  Richard NEMEC, SOFTEC, Bratislava, Slovakia, Europe
(___ \  |  \   (| |  phone:  +42-7-273805
(_____)____/_|\_\_|  e-mail: nemec@softec.sk
 ____ _  ___  ___    www:    -- N/A --
|    ) |/ __)/   \   hobby:  iveta@home.dnv.sk
|   (| |___ \  |  \  ...:    ???
|_|\_\_|_____)____/  ____________________________________________________



PP mail system -- LAWSONW@sydney.ccur.com
Friday, July 12, 1996

G'day Riso!

Real stupid question:  have you considered Splitter windows?
Without thinking too hard about it, seems to me that you ought
to be able to do whatever you like after an UpdateAllViews  --
i.e., display attributes rather than a portion of the real document.

Regards,
Jim Lawson Williams



Josef Haslinger -- josef.haslinger@gascad.telecom.at
Monday, July 15, 1996

Riso Nemec wrote:

[snip]

I had a similar problem and i replaced the current view of a splitter window. But i had to 
write my own ReplaceView function:

//
// replace the view of a splitter window 
//
BOOL ReplaceView( CSplitterWnd* pSplitter, int row, int col,CRuntimeClass * pViewClass, SIZE 
size)
{
  CCreateContext context;
  BOOL           bSetActive;     
   
  if(( pSplitter->GetPane( row, col )->IsKindOf( pViewClass )) == TRUE )
    return FALSE;
  
  // Get pointer to CDocument object so that it can be used in the creation 
  // process of the new view
  CDocument* pDoc = ((CView *)pSplitter->GetPane( row, col ))->GetDocument();
  CView*     pActiveView = pSplitter->GetParentFrame()->GetActiveView();
  if( pActiveView == NULL || pActiveView == pSplitter->GetPane( row, col ))
    bSetActive = TRUE;
  else
    bSetActive = FALSE;

  // set flag so that document will not be deleted when view is destroyed
  pDoc->m_bAutoDelete=FALSE;    

  // Delete existing view 
  ((CView *) pSplitter->GetPane( row, col ))->DestroyWindow();

  // set flag back to default 
  pDoc->m_bAutoDelete=TRUE;

  // Create new view                      
  context.m_pNewViewClass   = pViewClass;
  context.m_pCurrentDoc     = pDoc;
  context.m_pNewDocTemplate = NULL;
  context.m_pLastView       = NULL;
  context.m_pCurrentFrame   = NULL;

  pSplitter->CreateView( row, col, pViewClass, size, &context );

  CView * pNewView= (CView *)pSplitter->GetPane( row, col );

  if( bSetActive==TRUE )
    pSplitter->GetParentFrame()->SetActiveView( pNewView );

  pSplitter->RecalcLayout(); 
  pNewView->OnInitialUpdate();
  pSplitter->GetPane( row, col )->SendMessage( WM_PAINT );

  return TRUE;
}

-- 
Josef Haslinger GASCAD Gesellschaft fьr Computer Aided Design Ges.m.b.H
Wehrgrabengasse 33 A-4400 STEYR / AUSTRIA / EUROPE
Phone: ++43 7252 82323 17 Fax: ++43 7252 82323 9 (private: hasling@art.at / 07477 43821)




| Вернуться в корень Архива |