EMI_AddMenuItem (EMI Function)
- Updated2023-03-14
- 1 minute(s) read
EMI_AddMenuItem (EMI Function)
Owning Class: User Interface
Requires: Control Design and Simulation Module
Prototype
void EMI_AddMenuItem(emiRef model, const char* menuText);
Description
Adds a custom item to the shortcut menu of the External Model function. You can call this function only from the EMI_CB_ModelInterface function. Use the EMI_CB_HandleCustomMenuItem function to handle the shortcut menu item you add.
Inputs
| Name | Description |
|---|---|
| model | Specifies a reference to the external model. Use this reference as an input to other EMI functions. Do not modify model directly. |
| menuText | Specifies the text for the shortcut menu item. |
Examples
void EMI_CB_ModelInterface(emiRef model) {
EMI_AddMenuItem(model, "First Menu"); /* has index 0 */
EMI_AddMenuItem(model, "Second Menu"); /* has index 1 */
}
void EMI_CB_HandleCustomMenuItem(char* configParams, unsigned int menuItemIndex, char *modelHasChanged) {
switch(menuItemIndex) {
case 0:
/* respond to the first menu item */
modelHasChanged = 0;
break;
case 1:
/* respond to the second menu item */
modelHasChanged = 1;
break;
}
}