Azzera filtri
Azzera filtri

How do I disable Simulink Toolstrip Actions in MATLAB R2023b?

10 visualizzazioni (ultimi 30 giorni)
I'm building a GUI for a tool that allows a user to build Simulink system models. I'm creating a Simulink model template to have consistent models built by the user. I'm trying to disable actions in the Simulink toolstrip to avoid the user working outside the GUI. I'm using the article:
as a guide on how to do this but I'm having difficulty getting this to work. I'm confused because in this article, it says "To get the name and icon for a built-in action from the Simulink Toolstrip, use the 'slToolstripDeveloperMode' function." Following the example shown in the article, when I pause and click CTRL over the new model icon, I get:
Action: createNewModelAction
Icon: model
But the example in the article uses the syntax:
function sl_customization(cm)
cm.addCustomFilterFcn('Simulink:NewModel',@myFilter);
end
function state = myFilter(callbackInfo)
state = 'Disabled';
end
This syntax works to Disable the new model button. My question is, why is the syntax 'Simulink:NewModel' and not 'Simulink:createNewModelAction'? What am I missing and how do I find the correct syntax to use for the other actions in the toolstrip?

Risposta accettata

Deep
Deep il 26 Ott 2023
Modificato: MathWorks Support Team il 26 Ott 2023
The action names that show up in the MATLAB Command Window after you hover over an icon and press CTRL should be used as-is. Note, to turn on this feature, run
>> slToolstripDeveloperMode('on')
In the question proposed, "createNewModelAction" should be passed to the method "addCustomFilterFcn". For example, the following code placed in "sl_customization.m" disables the "Model" icon. 
function sl_customization(cm)
cm.addCustomFilterFcn('createNewModelAction',@myFilter);
end
function state = myFilter(callbackInfo)
state = 'Disabled';
end
Note that while "Simulink:NewModel" works as per the documentation example, this tag name does not follow the action names written in the documentation. The inconsistency in our documentation has been relayed to our development team to consider updating in future releases.

Più risposte (0)

Categorie

Scopri di più su Simulink Environment Customization in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by