Introduction

When I first started using Microsoft VC++, I found it boring to put a tab control in a form or in a dialog. I had to create the dialogs, fill in the TCITEM structure for each of my tabs, and finally insert them into the tab control. With CXTabCtrl it is far simpler, as is
illustrated below:-

The OnSelChange that you previously had to implement in the dialog (or form) to show the correct dialog is now in the CXTabCtrl, so you don't have to worry about it. You can even disable a tab so the user cannot see its contents.

m_tabctrl.EnableTab(1/*index*/, FALSE);

You can also change the color for the following states of each tab:-

Selected tab

Unselected tab

Disabled tab

A mouse over tab

You can select a tab from it's caption, or dynamically change a tab. In addition to this, you can select the previous or next tab with the SelectNextTab method.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Comments and Discussions

It turns out one of our company`s application uses your code without noticing you. Sorry for all the late but I am wondering if I can use your code for the application, since there is no statement about the license of your code.

On it's good side, a perusal of the CXTabCtrl code will give one an idea of how much work it takes to wrap the functions for a tab control. However, the even the example code doesn't work correctly. Witness the above compaints about Tab Focus and Tab Page Blanking for <enter> and <esc> Key Presses. I have put a substantial amount of time into developing some applications with this code only to find out the underlying code doesn't work properly. Needless to say I am a little frustrated.
The Code described in this article could really have used some debugging before posting. That's not to say that there isn't good work to be found here. It's just not polished. Hopefully, the author can make some revisions. However, it is unlikely seeing as he hasn't seen fit to provide feedback to the comments made on his article/code.

I am the mfc new hand and i want to use the class.
first i build a dialog mfc exe project.
And i include the XTabCtrl.h and XTabCtrl.cpp to my project.
But i use the classwizard i can't see the cxtabctrl class when i want to add variable?

how can i use the class?
i really have no idea?
any body can help me?
my email is m9021005@stmail.cgu.edu.tw
thanks.