Class: Toolbox

Constructor

Toolbox

new Toolbox(workspace)

Class for a Toolbox. Creates the toolbox's DOM.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace in which to create new blocks.

Value must not be null.

Class

Properties

config_

non-null Blockly.tree.BaseNode.Config

height

number

Height of the toolbox, which changes only in horizontal layout.

HtmlDiv

Element

HTML container for the Toolbox menu.

HtmlDiv

non-null Element

HtmlDiv

non-null Element

RTL

boolean

Is RTL vs LTR.

toolboxPosition

number

Position of the toolbox and flyout relative to the workspace.

treeSeparatorConfig_

non-null Blockly.tree.BaseNode.Config

width

number

Width of the toolbox, which changes only in vertical layout.

Methods

addStyle

package

addStyle(style)

Adds a style on the toolbox. Usually used to change the cursor.

Parameter

style

string

The name of the class to add.

clearSelection

clearSelection()

Unhighlight any previously specified option.

dispose

dispose()

Dispose of this toolbox.

getClientRect

getClientRect() returns Blockly.utils.Rect

Return the deletion rectangle for this toolbox.

Returns

Blockly.utils.Rect Rectangle in which to delete.

getFlyout

getFlyout() returns Blockly.Flyout

Get the toolbox flyout.

Returns

Blockly.Flyout The toolbox flyout.

getHeight

getHeight() returns number

Get the height of the toolbox.

Returns

number The width of the toolbox.

getWidth

getWidth() returns number

Get the width of the toolbox.

Returns

number The width of the toolbox.

init

init()

Initializes the toolbox.

Throws

Error If missing a require for both Blockly.HorizontalFlyout and Blockly.VerticalFlyout.

onBlocklyAction

package

onBlocklyAction(action) returns boolean

Handles the given Blockly action on a toolbox. This is only triggered when keyboard accessibility mode is enabled.

Parameter

action

Blockly.Action

The action to be handled.

Value must not be null.

Returns

boolean True if the field handled the action, false otherwise.

position

position()

Move the toolbox to the edge.

refreshSelection

refreshSelection()

Update the flyout's contents without closing it. Should be used in response to a change in one of the dynamic categories, such as variables or procedures.

removeStyle

package

removeStyle(style)

Removes a style from the toolbox. Usually used to change the cursor.

Parameter

style

string

The name of the class to remove.

renderTree

package

renderTree(languageTree)

Fill the toolbox with categories and blocks.

Parameter

languageTree

Node

DOM tree of blocks.

selectFirstCategory

package

selectFirstCategory()

Select the first toolbox category if no category is selected.

updateColourFromTheme

package

updateColourFromTheme()

Updates the category colours and background colour of selected categories.