Description
The createButton
function creates an interactive button that executes the specified action
when clicked. The button may not be available in all views.
Syntax
createButton(state, title, tooltip, action, [borderColor], [fillColor], [textColor], [successMessage], [failureMessage], [icon])
Arguments
Argument | Description |
state |
Indicates whether the button is clickable (state=1 ) or not (state=0 ). |
title |
The text displayed on the button. |
tooltip |
A tooltip text that appears when the user hovers over the button. |
action |
The action executed when the button is clicked. |
borderColor (optional) |
The color of the button's border. |
fillColor (optional) |
The background color of the button. |
textColor (optional) |
The color of the button text. |
successMessage (optional) |
A message displayed when the action is successfully executed. |
failureMessage (optional) |
A message displayed when the action fails. |
icon (optional) |
The icon displayed on the button. Can be specified as the name of a supported icon (e.g., "calculator" ). |
Return Types
The function creates and returns an interactive button that appears in the user interface.
Example
createButton(1, "Save", "Saves the changes", "saveAction", "blue", "green", "white", "Successfully saved!", "Save failed", "disk")
The example createButton(1, "Save", "Saves the changes", "saveAction", "blue", "green", "white", "Successfully saved!", "Save failed", "disk")
creates an interactive button with the following properties:
- state: The button is clickable (
state=1
). - title: The button text is "Save".
- tooltip: When the user hovers over the button, the tooltip "Saves the changes" appears.
- action: Clicking the button executes the
saveAction
. - borderColor: The button's border is blue.
- fillColor: The button's background color is green.
- textColor: The button text color is white.
- successMessage: After the action successfully completes, the message "Successfully saved!" is displayed.
- failureMessage: If the action fails, the message "Save failed" is displayed.
- icon: The icon on the button is "disk".
The return value is the created button with these properties, which is displayed in the user interface and executes the saveAction
when clicked.
Comments
0 comments
Please sign in to leave a comment.