Editing component tag in App Designer
34 次查看(过去 30 天)
显示 更早的评论
I cannot find a way to edit component (Button, CheckBox, DropDown, etc.) tags in App Designer. Tag is not a property accessible through the component browser. Am I missing something?
0 个评论
回答(4 个)
Jeff Baker
2020-6-2
A good use for the tag property is if many buttons will share the same callback. The callback can use the event.Source.Tag property to figure out which button was pressed.
0 个评论
Adam
2019-2-21
编辑:Adam
2019-2-21
You should have a 'Component Browser' (mine is top right of the screen with default layout) with your components in a tree under the figure. You can double click on the name after app. and edit it.
![stuff.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205225/stuff.png)
11 个评论
Adam
2019-12-2
I'm not stopping anyone else from answering the question!
I see no valid purpose for 'tag' when using app designer. The purposes for which it had a use in GUIDE are no longer valid in my opinion (and apparently in the opinion of those who created app designer), so that was the basis of my answer and attempting to understand why someone would need to use the 'tag'.
Other people are free to give different answers and are also free to completely ignore my answer.
Dan
2020-1-20
I think control of the tag would be very nice to have. I'm trying to create save and load state functions for my tool and if I could cross reference the components by unique tag names, that would help. Currently, I have to look at where the component is in the gui hierarchy AND cross reference a neighboring label in some cases to uniquely identify a component. I don't care to have my save function depend on the gui hierarchy because I might move a component. Ideally, the tag reflects the component name specified by the author.
Is there anyway to reference the component name programmatically? That would be the best solution for me. I don't see it in the property list.
Dan
2020-1-20
编辑:Dan
2020-1-20
Nothing like writing a response and figuring it out a few minutes later ...
Apps have public properties for each gui item that can be referenced generically as a list using the metaclass function. Therefore, no need for tags.
Short answer: Use public properties to reference the GUI items instead of tags ... tags provide no added value that I can see other than the need to tag things dynamically (which could be done of course).
0 个评论
Ajay Pattassery
2020-4-28
编辑:Ajay Pattassery
2020-4-28
You can edit tag property of a component by locating the component in the component browser and then search for the property tag in the property inspector.
Refer the attached image.
2 个评论
Ajay Pattassery
2020-5-2
You can search in the component browser for Tag property from R2020a. But in R2019a you can use the Tag property programmatically.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!