CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Splitter

  1. #1
    Join Date
    May 1999
    Posts
    76

    Splitter

    How do I create a split window? Please explain it very basic.

    David Forrester,
    [email protected]

  2. #2
    Guest

    Re: Splitter

    A great book for you would be Inside Visual C++, by Kruglinski.


  3. #3
    Join Date
    May 1999
    Posts
    78

    Re: Splitter

    There are 2 typesynamic and static....
    in MFC app wizard step 4...select advance,then select the window style tab on top and click on the split option .....

    in case of the static option use:
    u To create a static splitter window
    1. Add a CSplitterWnd object to the CMainFrm class in an SDI application (or to the CChildFrame class in an MDI application).

    Note You can use MFC AppWizard or the Gallery to add the splitter object. However, you will need to replace the code generated by MFC AppWizard or the Component gallery to make it appropriate for a static splitter.

    2. Add the classes for the additional views that you want in your application.

    Note You can use ClassWizard to add new view classes.

    3. Associate each view with the appropriate pane of the splitter.

    When you use AppWizard to create an application, you choose the base class for the view in Step 6. AppWizard adds this single view class to your application. You can then use ClassWizard to add other view classes, derived from the appropriate view base classes, to your application, and to eventually display each in a pane of a static splitter window.
    u To implement a static splitter window in an application
    1. Initialize the CSplitterWnd object by calling the CSplitterWnd::CreateStatic function in the OnCreateClient function of the frame class.
    2. Associate the appropriate views with each pane. To do so, call the CSplitterWnd::CreateView function for each pane that you created in the call to CSplitterWnd::CreateStatic.

    This sample code creates and implements a static splitter using the OnCreateClient function.
    Command Handler Issues
    In a dynamic splitter application, command handlers are generally placed in the view class; the view class has the easiest access to the document, and commands often modify the data in the document.
    However, in a static splitter, there are generally multiple views. Depending on what is appropriate for your application, you will have to decide where you want to place your command handlers. If you want the same commands enabled no matter which view has focus, place the handlers in the frame class. If you want each view to have its own set of handlers, add the appropriate handlers to each view class.
    Coordinating Updates in the Views
    In some cases, calling UpdateAllViews is not the best solution for updating the view in a document.



    The various types of splitter windows are described in the following table.
    Splitter Window Type Characteristics Comments

    Dynamic splitter Windows Maximum of four panes (two rows x two columns).
    Cannot have different types of views associated with the panes. Typically used to enable the user to scroll to different areas of the document in each pane.
    Static Splitter Windows Max. of 256 panes (16 rows x 16 columns).
    Can associate different views with each pane. You must add the additional views to your application and associate them with the panes.

    // SAMPLES\C07\splitter
    // MainFrm.h : interface of the CMainFrame class

    class CMainFrame : public CFrameWnd
    {
    ...
    protected:
    CSplitterWnd m_wndSplitter;
    ...
    };


    // MainFrm.cpp : implementation of the CMainFrame class

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    // ...
    // This is the code for a static splitter.
    CRect cr;
    GetClientRect(&cr);

    CSize paneSize(cr.Width(), cr.Height() / 2);

    int rc;
    m_wndSplitter.CreateStatic(this, 2, 1);

    rc = m_wndSplitter.CreateView(0, 0,
    RUNTIME_CLASS(CSplitterView),
    paneSize, pContext);
    if (FALSE == rc)
    return rc;

    rc = m_wndSplitter.CreateView(1, 0,
    RUNTIME_CLASS(CItalicsView),
    paneSize, pContext);
    return rc;
    }


    Good Luck,,,,,,,,,,,,,,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured