<< Click to Display Table of Contents >> CommandBars (collection) |
Access path: Application à CommandBars
1 Description
The CommandBars collection contains all of PlanMaker's toolbars. The individual elements of this collection are of the type CommandBar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
2 Access to the collection
There is exactly one instance of the CommandBars collection during the whole runtime of PlanMaker. It is accessed through Application.CommandBars:
' Show the name of the first toolbar
MsgBox pm.Application.CommandBars.Item(1).Name
' The same, but easier, using the default property
MsgBox pm.CommandBars(1)
3 Properties, objects, collections and methods
Properties:
▪Count R/O
▪DisplayFonts
▪DisplayTooltips
Objects:
▪Item → CommandBar (default object)
▪Application → Application
▪Parent → Application
Count (property, R/O)
Data type: Long
Returns the number of CommandBar objects in the collection, i.e. the number of toolbars available.
Note: Toolbars work only in classic mode. They do not work with ribbons.
DisplayFonts (property)
Data type: Boolean
Gets or sets the setting "Show fonts in font lists" (True or False).
DisplayTooltips (property)
Data type: Boolean
Gets or sets the setting whether a tooltip should be displayed when the mouse cursor is pointed to a toolbar button. Corresponds to the setting "Show tooltips" in the dialog box of PlanMaker's ribbon command Files | Options.
Item (pointer to object)
Data type: Object
Returns an individual CommandBar object that you can use to access an individual toolbar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Which CommandBar object you get depends on the value that you pass to Item. You can specify either the numeric index or the name of the desired toolbar. Examples:
' Make the first toolbar invisible
pm.Application.CommandBars.Item(1).Visible = False
' Make the toolbar named "Formatting" invisible
pm.Application.CommandBars.Item("Formatting").Visible = False
Note: It is not advisable to hard-code the names of toolbars in your program, since these names are different in each language that PlanMaker's user interface supports. For example, if you are using PlanMaker in English, the format bar is not called "Format", but "Formatting".
Instead, it is recommended to use the following symbolic constants for toolbars:
pmBarStatusShort = 1 ' Status bar (no documents open)
pmBarStandardShort = 2 ' Standard toolbar (no documents open)
pmBarStatus = 3 ' Status bar
pmBarStandard = 4 ' Standard toolbar
pmBarFormatting = 5 ' Formatting toolbar
pmBarObjects = 6 ' Objects toolbar
pmBarEdit = 7 ' Edit toolbar
pmBarOutliner = 8 ' Outliner toolbar
pmBarChart = 9 ' Chart toolbar
pmBarFormsEditing = 10 ' Forms toolbar
pmBarPicture = 11 ' Picture toolbar
pmBarFullscreen = 12 ' Full-screen toolbar
Application (pointer to object)
Data type: Object
Returns the Application object.
Parent (pointer to object)
Data type: Object
Returns the parent object, i.e. Application.