Can I customize the toolbars and menus via SVB?

STATISTICA provides full access to all of its customization options via STATISTICA Visual Basic functions. A detailed discussion of the techniques available for customizing toolbars, menus, etc., and how to use these methods to fully customize or expand STATISTICA is beyond the scope of this introduction. There are many excellent books available that discuss in detail the CommandBars object and how to use it in (Microsoft) Windows applications (e.g., to customize Microsoft Office applications). In general, customizing toolbars, menus, pop-up menus, etc., is useful in order to:

  • Provide quick access to frequently used options or methods;

  • Program highly customized events; e.g., to customize the shortcut menu when the user clicks on certain objects by adding macro programs or links to other applications to that menu;

  • Program fully customized versions of STATISTICA dedicated to perform only few predefined tasks (e.g., a version for data entry only);

  • Add new options to STATISTICA developed by other vendors; those options could be invoked from a STATISTICA Visual Basic macro program, if they are accessible as reference libraries.

Example. The following example illustrates how to produce a custom toolbar, and how to attach to them particular events. (Note: This example refers to customizing the classic menus, not the ribbon bar.) After running this program, a new toolbar will be added to your installation of STATISTICA.

' This program illustrates how to add a custom toolbar
' to your STATISTICA program. Use the Tools pulldown

' menu option Customize, and the Toolbar tab to remove

' the custom toolbar from your application, after you

' added it via this program (or write another program

' that will remove the toolbar via the CommandBar.Delete

' method).

' Retrieve the CommandBars object for the current

' application; note that CommandBars is a property

' of the Application object, so when running a VB

' program from another application, you need to explicitly

' declare the STATISTICA application object, and CommandBars

' as a property of that object.

Dim bars As CommandBars
bars = CommandBarOptions.CommandBars(scBarTypeToolbar)
newBar As CommandBar

' The new toolbar will be called "Custom"

Set newBar = bars.Add("Custom")

' Insert the following toolbar options in the toolbar

newBar.InsertButton 1, scCmdStatsBasicStatsTables , , _
"Basic Stats"

newBar.InsertButton 2, scCmdStatsNonparametrics , , _

' Insert a vertical separator line.

newBar.InsertSeparator 3

'Make this a floating toolbar.

newBar.Position = scBarFloating

'Set the display mode.

newBar.Item(1).DisplayMode = scCommandDisplayTextAndImage
newBar.Item(2).DisplayMode = scCommandDisplayTextAndImage

'Make a pop-up menu item on the new toolbar, labelled "Others"

Dim menu As CommandBarItem
menu = newBar.InsertPopupMenu(4, "Others")

'Insert the following menu option under the pop-up menu "Others"

menu.Items.InsertButton 1, scCmdStatsMultipleRegression , , _

menu.Items.InsertButton 2, scCmdStatsANOVA , , "ANOVA"
menu.Items.Item(1).DisplayMode= _

menu.Items.Item(2).DisplayMode= _

'Insert as a third option in "Others" a button that will run a
'macro program when selected. That macro program could, for example,

'run another application, or perform other customizations.

menu.Items.InsertMacroButton 3, _
& _
"\Examples\Macros\Graph Examples\Henon Strange Attractor.svb"
menu.Items.Item(3).Caption="My Macro"

End Sub

This program will create the following toolbar:


To remove the new toolbar, select Customize from the Tools menu, and then select the Toolbars tab from the Customize dialog; select the new toolbar, and Delete it. (You could also write an SVB program to remove the new toolbar, using the CommandBar.Delete method.)