viksoe.dk

MS Outlook Navigation control

MS Outlook Navigation control


This article was submitted .


I have been wanting to write this control for some time now. It's a simple MS Outlook Navigation Bar.

It supports basic stuff, like icon-view and report-view. Multiple panels can be added, and they slide up and down when you click on them. There is no support for item renaming or repositioning.

The control got a little more complex than needed. Mostly because it's really three separate controls. Used together, they form a single Outlook control. However, each control can be used on its own.

The Outlook Pane

This is the actual Outlook list - displaying text and icons and sending notifications to the top-level window when items are clicked. Items are arranged as a list.
After creating the control, new items can be added by using the InsertItem() method. Add both a small- and large-icon ImageList with the SetImageList() method. To toggle between icons- and report-mode, use the SetViewType() with the LVIS_ICON and LVIS_REPORT constants.
It is really a subclassed ListBox control which is ownerdrawn (variable height).

The Outlook Pager

This control behaves much like the standard Windows Pager control. The control is used with a window that does not have enough display area to show all of its content. The control allows the user to scroll to the area of the window that is not currently in view.
The differences from the standard Pager control is, that the scroll buttons are attached on the right side of the view, and they look like ordinary push buttons.
It works just like the standard Pager control. That is, just use the SetChild() method to attach a window. Moreover, the Pager control sends out a PGN_CALCSIZE notification to its parent - asking it to measure and return the recommended size of the child view.

The Outlook Bar control

The Outlook Bar control act as containers for child windows. The control can contain one or more views, each presented with a header bar and a text label. The Outlook Bar control manages the size and position of the views assigned to it. Views scroll into place when the user clicks on the headers.
Any window can be added to it as a view, thus allowing you to add any custom control or widget. Only one window can be attached to a view.
It's really a ReBar control behind the scene, and each view is simply created as a new ReBar Band.

How to use it

The control is designed to be used in a view - and not particular for placement in a dialog. Because there are three controls in all, it is a little more complex to initialize than usual.

The control does not require the REFLECT_NOTIFICATIONS() macros because of its high need to be added to a splitter-type view.

The sample should show you how to build a simple Outlook bar with two panes.
Notice in the sample how the Outlook Pane is put inside an Outlook Pager control - allowing the Pane to be scrolled when it no longer fits the view.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 7.0 Library

See Also

The similar MS Access Bar control

Download Files

DownloadSource Code and sample (56 Kb)

To the top