Blockly. Input
Constructor
Input
new Input(type, name, block, connection)
Class for an input with an optional field.
Parameter |
|
---|---|
type |
number The type of the input. |
name |
string Language-neutral identifier which may used to find this input again. |
block |
The block containing this input. Value must not be null. |
connection |
Optional connection for this input. |
Properties
align
number
Alignment of input's fields (left, right or centre).
connection
fieldRow
non-null Array of non-null Blockly.Field
name
string
type
number
Methods
appendField
appendField(field, opt_name) returns Blockly.Input
Add a field (or label from string), and all prefix and suffix fields, to the end of the input's field row.
Parameter |
|
---|---|
field |
(string or non-null Blockly.Field) Something to add as a field. |
opt_name |
Optional string Language-neutral identifier which may used to find this field again. Should be unique to the host block. |
- Returns
-
non-null Blockly.Input
The input being append to (to allow chaining).
dispose
dispose()
Sever all links to this input.
init
init()
Initialize the fields on this input.
insertFieldAt
insertFieldAt(index, field, opt_name) returns number
Inserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row.
Parameter |
|
---|---|
index |
number The index at which to insert field. |
field |
(string or non-null Blockly.Field) Something to add as a field. |
opt_name |
Optional string Language-neutral identifier which may used to find this field again. Should be unique to the host block. |
- Returns
-
number
The index following the last inserted field.
isVisible
isVisible() returns boolean
Gets whether this input is visible or not.
- Returns
-
boolean
True if visible.
removeField
removeField(name)
Remove a field from this input.
Parameter |
|
---|---|
name |
string The name of the field. |
- Throws
-
Error
if the field is not present.
setAlign
setAlign(align) returns Blockly.Input
Change the alignment of the connection's field(s).
Parameter |
|
---|---|
align |
number One of Blockly.ALIGN_LEFT, ALIGN_CENTRE, ALIGN_RIGHT. In RTL mode directions are reversed, and ALIGN_RIGHT aligns to the left. |
- Returns
-
non-null Blockly.Input
The input being modified (to allow chaining).
setCheck
setCheck(check) returns Blockly.Input
Change a connection's compatibility.
Parameter |
|
---|---|
check |
(string, Array of string, or null) Compatible value type or list of value types. Null if all types are compatible. |
- Returns
-
non-null Blockly.Input
The input being modified (to allow chaining).
setVisible
setVisible(visible) returns Array of non-null Blockly.Block
Sets whether this input is visible or not. Used to collapse/uncollapse a block.
Parameter |
|
---|---|
visible |
boolean True if visible. |
- Returns
-
non-null Array of non-null Blockly.Block
List of blocks to render.