Tabbed Views

Here is a class CTabFrm that implements an MDI Frame (CMDIChildWnd) that holds

Up to 150 views.

You don't need to modify your views,just use this MDI frame with tab support.

You organize views in groups (up to 10 groups)

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 






Right clicking Tab button you can change style


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)

Download Source Code - 78 KB



Comments

  • Abroad Rumor - gucci Understood to be Absolutely Essential In recent times

    Posted by incockDak on 03/29/2013 08:03am

    Precisely why everyone is absolute wrong when it comes to gucci and consequently the reasons why you should certainly read this ground-breaking report. [url=http://growth-management.alachua.fl.us/comprehensive_planning/gucci.html]バック グッチ[/url] Hot questions regarding gucci resolved and consequently the reasons why you would need to start reading each and every term in this write up. [url=http://growth-management.alachua.fl.us/comprehensive_planning/saclongchamp.php]Sac longchamp soldes[/url] JmsKqkYtjXml [url=http://running-nike0.seesaa.net/]nike ランニング[/url]PhyFrgYezNow [[url=http://free-nike-nikeo.seesaa.net/]free nike[/url]JznLofPnsTwb [url=http://xn--nike-ul4c5c5fyqb.seesaa.net/]スニーカー nike[/url]IpiFemCgtAzw [url=http://nikejapan0.seesaa.net/]ナイキ[/url]WwoBsqGyuMpw [url=http://nikesneakersjp.seesaa.net/]スニーカー nike[/url]DwkRfhUeeUhx [url=http://nikegolf00.seesaa.net/]ナイキ[/url]EgmUyiCfvAmc [url=http://nikeshoes00.seesaa.net/]ナイキシューズ[/url]MqcPxpInyDbf [url=http://sneaker-adidas-jp.seesaa.net/]スニーカー アディダス[/url]ThrDykSosDzl

    Reply
  • Often the bvlgari purse Sector Call : Who cares for nothing revenues?!?

    Posted by expopmerm on 03/22/2013 08:30pm

    [url=http://www.mcmoutletjpinoue.com]mcm 通販[/url] mcm Adds New Life To The Old Challenge-- Defacto Basic [url=http://www.mcmsalejapanoka.com]mcm リュック[/url] Rib Tickling Funny Tasks Every mcm Admirer Definitely Should Test Drive [url=http://www.mcmzankijpshop.com]mcm 財布[/url] Examples Of The Procedure That's In Fact Allowing mcm-Professionals Grow Different questions about bvlgari purse replied and consequently why you should certainly review each word of this write up. [url=http://www.bvlgarishopjprie.com]ブルガリ[/url] The basics of the bvlgari purse that one could make full use of beginning today. [url=http://www.bvlgarioutletshopjp.com]ブルガリカフェ[/url] Howdy. . Together we can help make bvlgari purse more favorable ! [url=http://www.bvlgarisalekodojp.com]ブルガリブルガリ[/url] Concise study discloses the unquestionable facts about bvlgari purse and in what way it can cause problems for your corporation. [url=http://www.bvlgarisakaijpsale.com]ブルガリ[/url] The Astounding bvlgari purse 'cheat' That Might Fool Every one [url=http://www.bvlgariaokisalejp.com]ブルガリ[/url] Some kind of double take on bvlgari purse mcm Will Teach You Advanced Vernacular ; Our Team Enter The Procedure [url=http://www.mcmbagsjphadori.com]MCM 店舗[/url] mcm Fiction Compared To The Honest Aspects [url=http://www.mcmstorejpkodo.com]mcm バッグ[/url] Secret Tips On How To Rule Equipped With mcm

    Reply
  • Nice! other views?

    Posted by Legacy on 10/01/2002 12:00am

    Originally posted by: suzanne

    i'm trying to use different views (like a tree view, list view, etc) at the same time (one for each tab).

    no luck yet! any advice?

    Reply
  • Very nice.

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

    Originally posted by: Kwon Gi Ryun

    Thanks be to God!
    Good idea.

    Reply
  • It's nice

    Posted by Legacy on 10/20/2000 12:00am

    Originally posted by: Park Beyn sung

    good!
    

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

Top White Papers and Webcasts

  • Live Event Date: August 14, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Data protection has long been considered "overhead" by many organizations in the past, many chalking it up to an insurance policy or an extended warranty you may never use. The realities of today makes data protection a must-have, as we live in a data-driven society -- the digital assets we create, share, and collaborate with others on must be managed and protected for many purposes. Check out this upcoming eSeminar and join Seagate Cloud …

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds