Knowledge Base 
Specify where a CommandBar can be Docked 
 Saturday, November 9, 2024

Specify where a CommandBar can be Docked

The DockingFlags property is used to specify where a commandbar can be docked. The following is the list of possible values that can be applied to the DockingFlags property:

#define _ACB_CBDF_ALIGNTOP		0x00000001
#define _ACB_CBDF_ALIGNBOTTOM	0x00000002
#define _ACB_CBDF_ALIGNLEFT		0x00000004
#define _ACB_CBDF_ALIGNRIGHT	0x00000008
#define _ACB_CBDF_ALIGNANY		(_ACB_CBDF_ALIGNTOP + ;
                                    _ACB_CBDF_ALIGNBOTTOM + ;
                                    _ACB_CBDF_ALIGNLEFT + ;
                                    _ACB_CBDF_ALIGNRIGHT)
You can combine values to tailor to your needs, for example, you can specify that the commandbar can be docked only to the top or bottom of the form.

The code below illustrates how to limit a commandbar so that it can only be docked to the top and bottom of the form:
ThisForm.cmdBarStandard.DockingFlags = 3      && _ACB_CBDF_ALIGNTOP + _ACB_CBDF_ALIGNBOTTOM
ThisForm.CBM.InitCommandBars()
To completely disable docking, simply set the DockingFlags property to 0 and the DockPosition property to -1.
ThisForm.cmdBarStandard.DockingFlags = 0
ThisForm.cmdBarStandard.DockPosition = -1
ThisForm.CBM.InitCommandBars()