![]() |
Source Code |
![]() |
![]() |
1 | ActiveX Controls |   |
  |
vbAccelerator ListBar Control |
|
An accurate reproduction of the Microsoft Outlook Bar, incorporating a solid ComCtl32.DLL ListView implementation in VB for you to play with! |
NOTE:
this code has been superceded by the version at the new site.
|
![]()
|
  |
Overview |
The vbAccelerator ListBar control is an all-VB control which emulates the Outlook sidebar
as accurately as possible. I was inspired to write it when I started playing with Microsoft's Spy++
utility and pointed it at Outlook's list bar (or "ShortcutBar" as it publicises itself to
the world) and noticed that the main component of the ListBar was actually a standard COMCTL32.DLL
ListView. Having just worked on Dan Litwin's excellent Custom-Draw
TreeView Control I figured there would be no problem implementing a ListView like this and next
thing there would be a super accurate Outlook Bar just ready for playing with. Not to mention
I could provide you with in-place editing without writing any code, and provide
Background Bitmap support so easily! How hard could it be?
Well, one day I will be older and wiser and will stop saying "How hard can it be?" and may even stop having to compile my code at 4:30am and dragging in to work the next day with flies buzzing around my head. One day. In the meantime, here are the results! Go download the TreeView and the S-Grid Control and you will have a serious pair of complementary tools for building real world UI solutions. Combine everything with the ultimate in Windows style using the CoolMenu/ToolBar/Rebar control and you're well on your way to having a killer business app! |
Objective Gratification |
One of the differences between this control and many of the previous controls at vbAccelerator
is that it has a fully-fledged object model - bars are programmed using the CListBar object which
is collected in the CListBars collection, and within a bar items are modified using a CListBarItem
object which is collected in the CListBarItems collection.
The collection is shown in the object model: ![]() vbAccelerator ListBar Object Model One of the issues with programming an object model like this is it is easy to get into problems with circular references; where objects are referred to by an external consumer of the control and by the control itself, which is also referred to by the consumer. Such problems can prevent the _Terminate event of objects ever firing. This situation is normally undesirable (causing memory leaks) but when you have subclassing and Win32 API controls it becomes uncontrollable, leading to UAE/GPFs whenever a form containing the control is closed. The object model coded in this control demonstrates one technique you can use to completely guarantee no possibility of a circular reference. The downside to the technique is that it requires more code to be run before an object is provided to the user. That isn't a problem in a control which is managing only a small number of objects, such as the Outlook bar (i.e. less than 1,000). But it would be unsuitable for use in a control like the vbAccelerator S-Grid control, which is currently capable of adding and displaying tens of thousands of objects at a reasonable speed. |
The Structure of the ListBar/Outlook Bar |
![]() As shown in the diagram above, the ListBar consists of 4 window parts.
|
Code Used in the ListBar Control |
The ListBar control draws from source code in a number of other articles here at vbAccelerator:
|
|
Documentation |
Documentation for the vbAccelerator ListBar control's properties, methods and classes
is available as an RTF. This documentation was
created with the ActiveX Documenter.![]() |
|
NOTE:
this code has been superceded by the version at the new site.
|
![]() |
|
About Contribute Send Feedback Privacy
|