Tabbed Views
Up to 150 views.
You don't need to modify your views,just use this MDI frame with tab support.
Each group can Hold up to 15 views.
You Can Select (Replace) a View using Tabcontrol o a command
To Configure a group your of tabs:
Fill in this struct
struct SELECTOR_VIEWS
{
int m_nViews; // number of tab for this group
char** m_prompt; // text of each tab
CRuntimeClass** m_listview ; // views associate with each tab
char* m_NomeGruppo; // group name
};
To Configure your CTabFrm:
Fill in this struct
struct GROUP_SELECTOR_LIST
{
int m_nGruppi; // haw many groups I have
int m_nGruppoIniziale; // what is initial group
BOOL m_bTab; // tab control STYLE TCS_TABS (TRUE) or TCS_BUTTONS (FALSE)
BOOL m_bBottom; // tab control STYLE TCS_BOTTOM
SELECTOR_VIEWS* m_ListaGruppi;
};
class CMYFrame : public CTabFrm // build each group// group 1 static char* p1[] = {"ALEX", "BILL", "PAUL", "JAMES", "DADDY" }; static CRuntimeClass* v1[] = {RUNTIME_CLASS(CAlex), RUNTIME_CLASS(CBill), RUNTIME_CLASS(CPaul), RUNTIME_CLASS(CJames), RUNTIME_CLASS(CDaddy) }; // group 2 static char* p2[] = {"PROMPT 1 GROUP2"}; static CRuntimeClass* v2[] = {RUNTIME_CLASS(CTabProjView)}; // group 3 static char* p3[] = {"PROMPT VIEW 1 GROUP3", "PROMPT VIEW 2 GROUP3", "PROMPT VIEW 3 GROUP3", "PROMPT VIEW 4 GROUP3", "PROMPT VIEW 5 GROUP3", "PROMPT VIEW 6 GROUP3", "PROMPT VIEW 7 GROUP3", "PROMPT VIEW 8 GROUP3", "PROMPT VIEW 9 GROUP3", "PROMPT VIEW 10 GROUP3", "PROMPT VIEW 11 GROUP3", "PROMPT VIEW 12 GROUP3", "PROMPT VIEW 13 GROUP3", "PROMPT VIEW 14 GROUP3" }; static CRuntimeClass* v3[] = {RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView) }; // group 4 static char* p4[] = {"PROMPT VIEW 1 GROUP 4", "PROMPT VIEW 2 GROUP 4", "PROMPT VIEW 3 GROUP 4", "PROMPT VIEW 4 GROUP 4", "PROMPT VIEW 5 GROUP 4" }; static CRuntimeClass* v4[] = {RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView), RUNTIME_CLASS(CTabProjView) }; // GROUP OF tabs (NUMERO VIEW, PROMPT ,OGGETTI VIEW) static SELECTOR_VIEWS enumgroup[] = { {5,p1,v1, "FAMILY GROUP"}, // 1 GROUP 5 views {1,p2,v2, "NAME GROUP2"}, // 2 group 1 view {14,p3,v3, "NAME GROUP3"}, // 3 group 14 views {5,p4,v4, "NAME GROUP4"} // 4 group 5 view }; static GROUP_SELECTOR_LIST g1[] = { 4, // number of groups 0, // initial group TRUE, // TABSTYLE = FALSE BUTTON = TRUE FALSE, // BOTTOM POSITION enumgroup // GROUP LIST };
The Class CtabFrm implements 28 commands :
COMMANDS FOR SETTING A GROUP IDM_SELECTOR_G1 (select group 1) IDM_SELECTOR_Gxxx (select group xxx) IDM_SELECTOR_G10 (select group 10) COMMANDS FOR CHANGE VIEW IN THE CURRENT GROUP IDM_REPLACE_VIEW1 (SELECT ITEM 1 IN THE CURRENT GROUP) IDM_REPLACE_VIEWxxx (SELECT ITEM xxx IN THE CURRENT GROUP) IDM_REPLACE_VIEW15 (SELECT ITEM 15 IN THE CURRENT GROUP) COMMANDS FOR CHANGE TABCONTROL STYLE IDM_TAB_BUTTON (TAB STYLE) IDM_ TAB_BUTTON (BUTTON STYLE) IDM_TAB_BOTTOM (MOVE BUTTONS DOWN) After the configuration the look of your application is


To use the class you have two choices:
A) method 1
derive your class
// Overrides the method virtual void OnGetGroups(GROUP_SELECTOR_LIST** gruppo); void CMYFrame:: OnGetGroups(GROUP_SELECTOR_LIST** gruppo) { *gruppo = g1; } if (you want to reserve pixel il the left side of your frame or in the down site of your frame) // Overrides the method virtual void OnReserved(int& dx,int& dy); void CMYFrame:: OnReserved(int& dx,int& dy { x = 160; //reserve 160 pixel in the left side of my frame }
B) method 2
Use the configurable class CTabFrame which allows you to use it directly ,just put this code in your application methos InitInstance() :
CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_TABPROTYPE, RUNTIME_CLASS(CTabProjDoc), RUNTIME_CLASS(CTabFrame), // custom Tab MDI child frame RUNTIME_CLASS(CTabProjView)); //default view AddDocTemplate(pDocTemplate); // BEGIN config your CTabFrame CTabFrame::SetSelector(g1); //CTabFrame::SetTabReserved(160,0); // SPACE ON THE LEFT LIKE ACCESS // CTabFrame::SetTabContext(UINT idsel,UINT idnosel) // your custom context menu // END CONFIG
In my example I use the second method
TabFrm.cpp TabFrm.h (base class) TabFrame .cpp TabFrame.h (configurable base class)