Contents
TabDlg Version 3.0

A custom control for creating Word 6.0 style tabs in a dialog box.

Copyright (c) 1994 Edward McCreary

Introduction

TabDlg will allow you to easily create tab-style option dialog boxes very similar to those found in Microsoft Word 6.0 and Visual C++ 1.5.  TabDlg is distributed as freeware.  This means that I retain ownership of the code but place only a few restrictions upon its use and redistribution.  These are:

If you are not distributing tabdlg3.dll with an application, please use the original archive file with the original contents and copyright notices.

If you are using tabdlg3.dll with an application, you may use it free of charge, but I ask that you include this copyright line somewhere in the documentation:

TabDlg3.DLL is Copyright (c) 1994 Edward McCreary

Other than that I place no restrictions upon its use.  I would like an email note if you use it in an application just so I can track how much its being used.  This will act as an incentive for me to keep writing these little snippets of code.

Eddie McCreary

edm@twisto.compaq.com

12/7/94

Disclaimer

Redistribution and use in source and binary forms are freely permitted provided that the above copyright notice and attribution and date of work and this paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILILTY AND FITNESS FOR A PARTICULAR PURPOSE.

Usage

I have completely rewritten the tab control from scratch.  This may be a pain for those of you using older versions, but I think the improvement is ease of use is well worth it.  The tab control is now a genuine custom control with a message based interface.  This takes care of problems with ctl3d.dll from Microsoft and makes it easier to use under other languages such as Pascal.

Heres step-by-step instructions for using the tabdlg3.dll in an application.

1.	Install tabdlg3.dll into the Windows system directory.  Only install if the version information in the new dll is newer than the one in the system directory!

2.	Copy tabldg3.lib and tabdlg3.h into your source directory and link tabdlg3.lib in with your project if youd like to.  Theres not much need to though.

3.	Design the master dialog.  This is the template used with CreateDialog or however you create your dialog boxes.  In it, place controls that are common across all tabs and the main tab control.  How you do this depends upon you resource editor.

4.	Design a dialog box for each tab.  The size of the template really doesnt matter but it should be as large as the master dialog box.  If you want, you can place a black frame in the new template to act as a reference, but it must have the same resource id as the black frame in the master dialog box.  Now, place the controls for that tab into the dialog box.  remember to leave space at the top of the black frame for the tabs themselves.  Dont forget to give each control a unique resource id, even across tabs.  If you dont care what the id of the controls is, as in the case of static text, give the control -1 for an id.  The custom control will assign is a unique id when it is created.

The caption of the tab template will be used as the caption of the tab.

5.	When you initialize your application, use LoadLibrary to load the dll into memory.  Youll need to call FreeLibrary as your application exits also.

6.	In response to WM_INITTAB of your main dialog box, send TAB_ADDTAB messages to the control to create the tabs.  If youre using MFC, do this before you call the OnInitDialog method of the parent class.

One new feature worth mentioning, if the tab control has focus (you can tell by the focus rect around the active tabs caption) you can use the right and left to change the active tab.

Also, you may want to respond to WM_CTLCOLOR and give your dialog box a light gray background.  If you are using ctl3d.dll from Microsoft, then you dont have to worry about it.

Thats it!  Theres no a whole lot to it.  Ive included sample code showing how to use it if you need to look at read code.  See below for a reference of all available messages.

Thanks Too...

Thanks to everyone who sent me email about the first two versions of the library.  Unfortunately, I didnt have time to integrate all of the features that I would have liked, but I think its more than usable now.  One thing Id like to add is the ability to add more tabs than are visible on the screen at one time.  The design allows for this to be added without too much trouble, but I just didnt have the time.  Also, James OBrien provided value feedback on this version.

Message Reference

TAB_ADDTAB	add tab to dialog box

wParam	if is zero, then lParam is a global handle to a dialog box template.

if it is non-zero, then it is the instance handle of the module to load the template from.

lParam	if wParam is zero, then lParam is a global handle to a dialog box template.

if wParam is non-zero, the lParam is a LPCSTR to the template name.

TAB_DELETETAB 	delete tab

wParam	index of tab to delete

lParam	not used

TAB_FINDTAB      	return index to tab

wParam	not used

lParam 	LPCSTR to tab caption

TAB_GETCOUNT     	returns number of tabs

wParam	not used

lParam	not used

TAB_GETCURSEL    	returns index of current tab

wParam	not used

lParam	not used

TAB_SETCURSEL    	sets current tab

wParam	index of new active tab

lParam	not used

TAB_GETTEXTLEN   	get length of caption for tab

wParam	index of tab to get caption length for

lParam	not used

TAB_GETTEXT      	get text of tab caption

wParam	index of tab to get caption for

lParam	LPSTR to buffer to copy tab to

tab notification message

TABN_CHANGETAB 	send to main dialog box when active tab is changed.