Docked, DockPosition

These properties tell whether a toolbar is docked and, if so, where. We can't see why there are two properties for this, since DockPosition contains all the information you need. Our guess is that Docked was originally planned, but Microsoft found that people needed more information, so they added DockPosition. Don't know why they didn't ditch Docked at the same time. Now we're stuck with another case of dBloat.

Usage

lIsDocked = tbrToolBar.Docked
nPosition = tbrToolBar.DockPosition

Parameter

Value

Meaning

nPosition

 

-1

Toolbar is not docked.

0

Toolbar is docked at top.

1

Toolbar is docked at left.

2

Toolbar is docked at right.

3

Toolbar is docked at bottom.


Toolbars can be docked by the user or programmatically using the Dock method. In either case, these properties get updated. However, if you use the Dock method to position a toolbar before it becomes visible, Docked and DockPosition don't reflect the new status until the toolbar is SHOWn.You can't change DockPosition directly. Use the Dock method instead. This means you can't preset the docking position for a toolbar in the Form Designer (or in the Class Designer). Use code like the example instead.

Example

* Pre-dock a toolbar at the top so it's ready when it appears
* This could go in the toolbar's Init event
This.Dock(0)

See Also

AfterDock, BeforeDock, Dock, Toolbar, Undock


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .