How do I disable Simulink Toolstrip Actions in MATLAB R2023b?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Deep
2023-10-26
编辑:MathWorks Support Team
2023-10-26
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!