SCanvas¶
| Property | Type | Note |
|---|---|---|
| Aka | String | Name for the widget |
| Position | Number Array, Length = 2 | |
| Size | Number Array, Length = 2 | For example:[100, 50] |
| Slots | Array | The array which contain children widgets |
| ToolTipText | String | |
| Visibility | Enum: EVisibility: Visible, Collapsed, Hidden, HitTestInvisible, SelfHitTestInvisible, All |
functions what can be called from ChameleonData¶
| FunctionName | Description | |
|---|---|---|
| append_slot_from_json | Add a child widget through the content of the JSON string. It's for the widget which has 'Slots'. | |
| remove_widget_at | Remove a child widget at Specified slot or widget. | |
| get_canvas_slot | None | |
| set_canvas_element_position | Set the position of Canvas element by AkaName. | |
| get_canvas_element_position | Get the position of Canvas element by AkaName. | |
| set_canvas_element_size | Set the size of Canvas element by AkaName. | |
| get_canvas_element_size | Get the size of Canvas element by AkaName. | |
| set_canvas_element_position_by_index | Set the position of Canvas element by Index. | |
| get_canvas_element_position_by_index | Get the position of Canvas element by Index. | |
| set_canvas_element_size_by_index | Set the size of Canvas element by Index. | |
| get_canvas_element_size_by_index | Get the size of Canvas element by Index. |
Examples¶
Example 1:
"SCanvas": {
"ToolTipText": "Canvas is a layout widget that allows you to arbitrary position and size child widgets in a relative coordinate space",
"Slots": [
{
"Position": [97.5, 0],
"Size": [25, 20],
"SButton": {"ButtonColorAndOpacity": [0, 5, 0 ,1], "OnClick": "print('Head.')",
"Text": "^_^"
}
},
{
"Position": [90, 22],
"Size": [40, 40],
"SButton": {"ButtonColorAndOpacity": [0, 2, 0 ,1], "OnClick": "print('Body.')"}
}
]
}