How do I disable Simulink Toolstrip Actions in MATLAB R2023b?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Joseph
am 7 Jul. 2023
Bearbeitet: MathWorks Support Team
am 26 Okt. 2023
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?
0 Kommentare
Akzeptierte Antwort
Deep
am 26 Okt. 2023
Bearbeitet: MathWorks Support Team
am 26 Okt. 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.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Environment Customization finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!