Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is so special about the main View class?

Status
Not open for further replies.

forlorn

Programmer
Dec 12, 2001
28
TR
Hi,

I am using a splitter to divide the screen into 2.
In each part i use a CTabCtrl driven class. So i aim to place 4 View classes. The problem occurs when i try to place the (AppName)View class (I don't know the term used for this class, sorry).

Here are the code snippets:


// Application's name is Bitirme

// CMainFrame::OnCreateClient
m_Splitter.CreateStatic( this, 1, 2 );
m_Splitter.CreateView( 0, 0, RUNTIME_CLASS( CMenuView ), CSize ( 200, 0 ), pContext );
m_Splitter.CreateView( 0, 1, RUNTIME_CLASS( CSonucView ), CSize ( 0, 0 ), pContext );

// CMenuView works fine, so i skip it.


// CSonucView::OnCreate
m_pNumerikView = ( CNumerikView * ) m_SonucTab.AddTabView( RUNTIME_CLASS( CNumerikView ), GetDocument(), this, 0, "Numerik Analiz" ); // This works

m_pBitirmeView = ( CBitirmeView * ) m_SonucTab.AddTabView( RUNTIME_CLASS( CBitirmeView ), GetDocument(), this, 1, "Grafik" ); // This causes trouble


I would be very grateful if could help me on this one. Thanks.
 
What base classes are CSonucView, CNumerikView, and CBitirmeView derived from?

You're using m_Splitter.CreateStatic() to allocate room for TWO views. So, when you use CreateStatic(), it means that ONLY THOSE TWO views will be created and used for the entire runtime of the application.

ONE of those static views is CMenuView, which you said works fine.

The SECOND static view is supposed to be CSonucView. However, you appear to create TWO runtime views, instead of one: CNumerikView AND CBitirmeView. Assuming that somehow the runtime uses CNumerikView in CSonucView's place, you still are referencing another, extra view, CBitirmeView.

I'm guessing the problem could be that the runtime doesn't know what to do with... how or where to display... the extra View.

If I'm wrong, someone please correct me. Thanks! ;-)
 
Hi,
All CSonucView, CBitirmeView, CNumerikView and CMenuView are derived from CView.

To CSonucView i'm trying to add two views. Maybe i should have written code snippet from CMenuView :

// CMenuView::OnCreate
m_pAnalizParamView = ( CAnalizParamView * ) m_MenuTab.AddTabView( RUNTIME_CLASS( CAnalizParamView ), GetDocument(), this, 0, "Numerik Analiz" );

m_pGrafikParamView = ( CGrafikParamView * ) m_MenuTab.AddTabView( RUNTIME_CLASS( CGrafikParamView ), GetDocument(), this, 1, "Grafik" );

Here CAnalizParamView and CGrafikParamView are again derived from CView.

So this is just the same as the in CSonucView. CMenuView is still one static view, but i could insert two views to its member tab control.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top