Implementing a custom tabbed dialog box.
tabcontroltut.cab (4Kb) - A MSDEV 6 project demonstrating the implementation of a simple tabbed dialog.
This is not a tutorial so much as a simple example project with some associated notes.
I have done some things in this example that help to keep it simple, but, to a degree, I regard them as "tricks".
The tab control itself does very little for you the programmer other than draw a raized box with some funny looking buttons accross the top.
The tabbing behaviour where the body of the tab controls changes as the tabs are clicked is completely application defined.
In this case I decided to create a number of frameless dialog boxes each containing the controls associated with a page and show and hide them as the user selected each tab.
- The example supports lazy creation of the dialog pages - each child dialog is only created when its page must be shown.
By assigning the resource id of the dialog to the dialog window the code can use GetDlgItem to get the handle of a page or determine that the page has not been created yet.
- When the active page is changed the application must change the focus itself.
At the moment the focus setting code blindly assumes that the first (ie. topmost in the z-order) control on the dialog can accept the focus and sets the focus to that.
- Finally - just to confuse further - the project is configured to compile without including the c-runtime when MSDEV 6 is used.
Remove the #pragma comment from the .cpp to allow it to compile & link cleanly on other platforms.