Saturday, October 18, 2008

ST_SplitterWnd

Are you tired of using CSplitterWnd?
ST_SplitterWnd can help your code working.

At least to me, ST_SplitterWnd is little better to use.
Left image used 3 SplitterWnd.

Generated with following codes





// Declare in your MainFrm.h
ST_SplitterWnd *m_pSplitterWnd1;
ST_SplitterWnd *m_pSplitterWnd2;
ST_SplitterWnd *m_pSplitterWnd3;
ST_SplitterWnd *m_pSplitterWnd4;



BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
m_pSplitterWnd1 = new ST_SplitterWnd();

// split into five panes :

// +-----+--------+
// | | |
// + +--------+
// | | |
// +--+--+--------+
// | |
// +--------------+

//
// workingh
m_pSplitterWnd1->Create(this,NULL, NULL,pContext,false);

m_pSplitterWnd2 = m_pSplitterWnd1->AddSubDivision(TOP_SIDE, NULL, NULL,pContext,true);
m_pSplitterWnd2->AddView(LEFT_SIDE, RUNTIME_CLASS(NFMainView),pContext);
m_pSplitterWnd2->SetColumnInfo(0, 600, 300);
//m_pSplitterWnd2->SetRowInfo(0, 400, 400);


m_pSplitterWnd3 = m_pSplitterWnd2->AddSubDivision(RIGHT_SIDE, NULL, NULL,pContext,false);
m_pSplitterWnd3->AddView(TOP_SIDE, RUNTIME_CLASS(NFDialerView), pContext);
m_pSplitterWnd3->AddView(BOTTOM_SIDE, RUNTIME_CLASS(NFMiscView), pContext);
m_pSplitterWnd3->SetRowInfo(0, 220, 120);
m_pSplitterWnd3->SetRowInfo(1, 220, 120);

m_pSplitterWnd1->AddView(BOTTOM_SIDE, RUNTIME_CLASS(NFOutputView),pContext);
m_pSplitterWnd1->SetRowInfo(0, 400, 300);
//m_pSplitterWnd1->HideRow(1);

}



SetColumnInfo and SetRowInfo give minimal spaces to keep visible. If pane has small spaces than in cxMin or cyMin, than pane will be hidden.

ST_SplitterWnd gives you Hide/Show pane functionality and SwitchView also.
Search Splitter in codeproject

Each pane uses CPropertyView for tabbed view. CPropertyView is MFC extension by YEAsoft.
Log Tab uses CrystalEdit as it's control.

No comments: