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.

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.

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.

Value must not be null.

selectFirstCategory

package

selectFirstCategory()

Select the first toolbox category if no category is selected.

setColourFromStyle_

setColourFromStyle_(styleName, childOut, categoryName)

Retrieves and sets the colour for the category using the style name. The category colour is set from the colour style attribute.

Parameter

styleName

string

Name of the style.

childOut

Blockly.tree.TreeNode

The child to set the hexColour on.

Value must not be null.

categoryName

string

Name of the toolbox category.

updateColourFromTheme

package

updateColourFromTheme()

Updates the category colours and background colour of selected categories.