Variable splitter views

Here is a class that implements an MDI Frame (CMDIChildWnd) which shows a number of variable views (up to 4 views).

The Class (CBaseVarFrame) is reusable.

It implement four new commands :

ID_SPLITTER_NESSUNO (Just Default View,no splitter)  // status = 0
ID_SPLITTER_UNO ( 2 Views ,Default View on the left pane,1 view in the right pane)  // status = 1
ID_SPLITTER_DUE ( 3 Views,Default View on the left pane,2 views in the right pane)  // status = 2
ID_SPLITTER_TREE (4 Views,Default View on the left pane,3 views in the right pane) // status = 3

To use the class you have two choices:

A) method 1

derive your class
class CMYFrame : public CBaseVarFrame
// use a static array of your runtime views
static    CRuntimeClass* myClass[3] =
{RUNTIME_CLASS(CView1),RUNTIME_CLASS(CView2),RUNTIME_CLASS(CView3)};

// Overrides the method

void CMYFrame::OnConfigViews()
{
  ConfigViews(myClass,  // array of RuntimeClass of Views
                            3,  // number of max of Views on the right pane
                            0); // initial status (see above)
}

B) method 2

Use the configurable class CBaseVariableFrame which allows you to use it directly ,just put this code in your application methos InitInstance() :
CMultiDocTemplate* pDocTemplate;
  pDocTemplate = new CMultiDocTemplate(
  IDR_VARSPLTYPE,
  RUNTIME_CLASS(CVarSplitDoc),
  RUNTIME_CLASS(CBaseVariableFrame), // custom MDI child frame
  RUNTIME_CLASS(CVarSplitView));       // your default views (left pane)
AddDocTemplate(pDocTemplate);

// TO DO : config your frame
CBaseVariableFrame::SetConfiguration(myClass,3,0);
// END CONFIG

In my example I use the second method

BaseVarFrame.cpp BaseVarFrame.h    (base class)
ChildFrm.cpp ChildFrame.h   (configurable base class)

Download Source 58KB



Comments

  • MSDN have SDI hint.

    Posted by Legacy on 08/26/2001 12:00am

    Originally posted by: Chanho Jung

    MSDN SUBJECT is:

    [HOWTO: Provide an Alternative View to Data Using Splitter Window]


    If you search it, you can see.

    Reply
  • The same problem: How to convert to SDI

    Posted by Legacy on 05/28/2001 12:00am

    Originally posted by: Annie

    I am a beginner using VC. 
    
    I don't know how to convert this application to SDI. Please help me. Thanks a lot.

    Reply
  • How to convert this to SDI?

    Posted by Legacy on 02/16/2000 12:00am

    Originally posted by: Zdenek

    I would like convert this example to SDI.
    
    

    ...but I do not know, how to do it.

    I have replaced:
    CMultiDocTemplate -> CSingleDocTemplate
    CMDIChildWnd -> CFrameWnd
    class CMainFrame : public CFrameWnd -> class CMainFrame : public CBaseVarFrame

    But, it does not work.

    Could you help me? Please.

    Reply
  • Bravo !!!

    Posted by Legacy on 09/18/1999 12:00am

    Originally posted by: Itzhak

    Thank You

    Reply
  • question about the view splitter

    Posted by Legacy on 07/23/1999 12:00am

    Originally posted by: soichi hayashi

    Though I am not sure if it's appricable to post this question here, I have an question about the view splitter.

    I am trying to create the application that has one document class, and 2 view classes that are sharing the same document. I have SDI application and created the splitter feature on my primary view class, but the second view classes won't connect with the document class that primary view class is using. what should i do to make it work?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds