Visual Basic List API Routines
VBnet 'CoolTabs' Visual Tabstop Designing Utility
Posted:   Friday August 8, 1998
Updated:   Monday December 26, 2011
Applies to:   VB4-32, VB5, VB6
Developed with:   VB5, Windows 98
OS restrictions:   None
Author:   VBnet - Randy Birch
Download:   VBnet CoolTabs v3.0.16 for VB6 (20k) (requires VB6 runtime)
VBnet CoolTabs.v2.0.06 for VB5 (20k) (requires VB5 runtime)


VBnet CoolTabs
GetTextExtentPoint32: Right-Align List Box Data
SetWindowLong: Right-Align List Box Data and/or the Scrollbar
SetWindowLong: Right-Align List Contents in a Combo
SendMessage: Align Text Box Contents Using Tabstops

SendMessage: Align List Box Contents Using Tabstops
WM_LBUTTONDOWN: Substitute a Tabbed List for a Combo's Dropdown List
WM_LBUTTONDOWN: Substitute a ListView for a Combo's Dropdown List
VB5 or VB6 runtime.

 About CoolTabs for List and Text Boxes
CoolTabs Version 3 for VB6 version has been released and updated with the new features listed below. The VB5 version remains at version 2, and at this time there are no plans for updating the VB5 version.

Version three improves on the tabstop algorithm and provides four specific enhancements.

  • Tabs are now left or right-aligned within the column selected, not outside the column as with version 2.
  • Tab array position 0 (the first tabstop) is the position of Col1, not the Anchor column as in version 2.
  • The tabstop code options have been moved to the code generation window and will dynamically change the code as options are selected.
  • The listbox resize code is now all handled via the listbox context menu.

Constructing the array required to set listbox or textbox tabstops requires a painful trial-and-error methodology for getting the tabs to align correctly. With the help of my friends at the Common Controls Replacement Project, the VBnet CoolTabs utility became a reality.

CoolTabs presents the user with a listbox and a number of pre-configurable settings. Pressing Create after setting the text and number of columns desired (or using the default settings), creates a header control via API overtop the listbox. The header column alignments correspond to the tabstops in the listbox - the tabstop array. Repositioning a ColumnHeader adjusts the tabstops, allowing full visual control over the design.

The first column (the Anchor) is fixed and justified left. All other column can be resized by repositioning the header dividers. Accessed via a header context menu, each remaining column can have either left or right-justified text against the tabstop, and columns can be inserted or deleted as required.

Resizing the CoolTabs window widens the list allowing the control to be accurately sized to match the list in your project.  And via the listbox context menu you can turn on list drag-resizing allowing you to reduce its size narrower than the CoolTabs form, or to fine-tune the width.

The tabstops are accurate for any font used, and the ChooseFont API is implemented to allow you to try new fonts. And an Apply button in the Font dialog makes it easy to see the changes in the listbox without closing.

Once the alignment and positions for the list item tabs have been determined, the Generate button to displays the code window with the appropriate code ready to copy and paste. You can optionally have the tool provide the necessary 32-bit declarations and constants, declared as Public, Private or local variables and constants, as well as specifying whether the code should be built for a listbox or a textbox, both of which support tabstops.

CoolTabs for Visual Basic 5 requires the VB5 Service Pack 2 runtime or later. CoolTabs for Visual Basic 6 will run with any version of the VB6 runtime. Both builds, to support the header, require comctl32.dll version 4.72 or later. The zip includes only the CoolTabs executable. And although the CoolTabs utility requires a VB5 or VB6 runtime, the tabstops generated will work against VB4-32 lists and textboxes as well.



PayPal Link
Make payments with PayPal - it's fast, free and secure!


Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy


Hit Counter