-
Notifications
You must be signed in to change notification settings - Fork 14
Item functions
Kiminaze edited this page Apr 8, 2022
·
2 revisions
Attach a function to the specified item when it is clicked.
ECM:OnActivate(itemId, function()
end)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item for the function. |
| func | function | - | The function that should be executed when clicking the item. |
Attach a function to the specified item when left click is released.
ECM:OnRelease(itemId, function()
end)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item for the function. |
| func | function | - | The function that should be executed when releasing left click. |
Attach a function to a CheckboxItem when the checkbox value is changed.
ECM:OnValueChanged(itemId, function(value)
end)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item for the function. |
| func | function | - | The function that should be executed when releasing left click. |
| Function parameter | Type | Range | Description |
|---|---|---|---|
| value | bool | true or false | If the checkbox was (un)checked |
Change if the item should be enabled or disabled. A disabled item is still shown but has no functionality.
Returns current state when called without the enabled parameter.
ECM:Enabled(itemId, enabled)
-- OR
local isItemEnabled = ECM:Enabled(itemId)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item to change. |
| enabled | bool | true or false | If the item should be enabled or disabled. |
| Return value | Type | Range | Description |
|---|---|---|---|
| isItemEnabled | bool | true or false | If the item is currently enabled. Only used if enabled parameter is left empty. |
Change if the menu should close itself when the specified item is clicked.
ECM:CloseOnActivate(itemId, closeOnActivate)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item to change. |
| closeOnActivate | bool | true or false | If the item should close the menu on left click. |
Change the text of an item that is aligned on the right hand side. Returns the current right text title if the text parameter is not provided.
ECM:RightText(itemId, text)
-- OR
local rightTextTitle = ECM:RightText(itemId)| Parameter | Type | Range | Description |
|---|---|---|---|
| itemId | integer | 0 and above | The item to change. |
| text | string | - | The text that should be displayed on the right side of the item. |
| Return value | Type | Range | Description |
|---|---|---|---|
| rightTextTitle | string | - | The title of the right text of the item. Only returned when text parameter is left empty. |