MATLAB Answers

Editing component tag in App Designer

76 views (last 30 days)
Eric H.
Eric H. on 21 Feb 2019
Edited: Dan on 20 Jan 2020 at 16:57
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?


Sign in to comment.

Answers (2)

Adam on 21 Feb 2019
Edited: Adam on 21 Feb 2019
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.


Show 8 older comments
Carsten Ridder
Carsten Ridder on 1 Dec 2019
Please, Adam, do you have an answer to the very simple question: "How can the property "Tag" be given a value in the appdesigner?" If it is not possible, then don't be afraid to admit that!
I have the exact same need myself. For now I have to write this manually somewhere in the code: e.g. "app.SwitchLocTab.Tag = 'LocPar';", which is just stupid. As Eric wrote: " I would rather not have to clutter up a startup function or have to write a special function to set the Tag property of dozens of UI components."
You ask yourself: "How is the tag different to the name?" - if you don't know that please let another person answer the question!
Adam on 2 Dec 2019
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 on 20 Jan 2020 at 16:43
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.

Sign in to comment.

Dan on 20 Jan 2020 at 16:57
Edited: Dan on 20 Jan 2020 at 16:57
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).


Sign in to comment.

Sign in to answer this question.