Skip to main content

ToolBar

Detailed Description

The ToolBar class is a movable panel that contains a set of buttons, groups of buttons can be separated using addSeparator(). The tool bar can be shown with open().

Example code

In the code below, you will create a tool bar with buttons:

const toolbar = new ToolBar();

const fileButton = new Button(toolbar, 'File', 'file_32.png');
fileButton.mode = Button.SmallIcon;

const cameraButton = new Button(toolbar, 'Camera', 'cameras_32.png');
cameraButton.mode = Button.SmallIcon;

toolbar.addSeparator();

const buttonGroup = new ButtonGroup();
const fringeButton = new ToggleButton(toolbar, 'Fringe', 'Results-Parts_32.png');
fringeButton.mode = Button.SmallIcon;
fringeButton.group = buttonGroup;

const cutPlaneButton = new ToggleButton(toolbar, 'Cut Plane', 'Results-Planes_32.png');
cutPlaneButton.mode = Button.SmallIcon;
cutPlaneButton.group = buttonGroup;

const isoSurfaceButton = new ToggleButton(toolbar, 'Iso Surface', 'Results-Iso_Surfaces_32.png');
isoSurfaceButton.mode = Button.SmallIcon;
isoSurfaceButton.group = buttonGroup;

const traceButton = new ToggleButton(toolbar, 'Trace', 'Plane-Trace_32.png');
traceButton.mode = Button.SmallIcon;
traceButton.group = buttonGroup;

buttonGroup.checkedButton = cutPlaneButton;

toolbar.open(new Point(10, 150));

The orientation parameter of constructor determines whether the tool bar is horizontal or vertical:

const toolbar = new ToolBar(Orientation.Vertical);
...