Editing component tag in App Designer

41 visualizzazioni (ultimi 30 giorni)
Eric H.
Eric H. il 21 Feb 2019
Risposto: Jeff Baker il 2 Giu 2020
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?

Risposte (4)

Jeff Baker
Jeff Baker il 2 Giu 2020
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.

Adam il 21 Feb 2019
Modificato: Adam il 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.
  11 Commenti
Dan il 20 Gen 2020
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.

Accedi per commentare.

Dan il 20 Gen 2020
Modificato: Dan il 20 Gen 2020
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).

Ajay Pattassery
Ajay Pattassery il 28 Apr 2020
Modificato: Ajay Pattassery il 28 Apr 2020
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 Commenti
Ajay Pattassery
Ajay Pattassery il 2 Mag 2020
You can search in the component browser for Tag property from R2020a. But in R2019a you can use the Tag property programmatically.

Accedi per commentare.


Scopri di più su Environment and Settings in Help Center e File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by