When a tag is defined for an app designer slider, the value-changing-function for that slider is not triggered.
Show older comments
I'm using Version R2024a. When I create a slider component in App Designer and define a ValueChangingFcn for it, it works fine ... as long as "Tag" (in the "Identifiers" section of the slider) has not been defined. That is, the ValueChangingFcn callback is called as I drag the slider. However, if I define Tag (e.g. 'abc' without the quotes), then the ValueChangingFcn is no longer called when I drag the slider.
I should mention that this appears to occur only with the slider. With a Numeric Edit Field, the presence of a tag has no adverse effect on the call to its callback.
Does anyone know a workaround?
13 Comments
Stephen23
on 7 Oct 2024
"When a tag is defined for an app designer slider, the value-changing-function for that slider is not triggered."
I tried it just now on R2024b, it worked exactly as expected. The app I just created to test this is attached.
Sherman Marcus
on 7 Oct 2024
dpb
on 7 Oct 2024
Have you checked for any updates for your installation? Which OS and updates for it? Added any new apps to the system?
Does the symptom appear for all sliders or only one?
Does the existing slider then trigger if you clear the 'Tag' property?
Does the problem reoccur if you delete the slider(s) and recreate them?
If the symptom does not go away if you delete all sliders and recreate them and since you note it did not appear in a new app, it would appear something has corrupted the particular project and you may have no recourse but to recreate it unless you have an earlier save version from before the time the symptom appeared that you can use as a starting point.
If it doesn't go away and you can't recreate, the only alternatives I see would be to
- Don't use the 'tag' property on the affected slider(s), or
- Use 'UserData' in lieu of 'Tag', presuming that also doesn't cause the symptom
I would also suggest you could attach the .mlapp file to the forum and others could then see if the symptom is reproducible on other installations.
If none of the above resolve the issue, then submit an official support request...
Steven Lord
on 7 Oct 2024
Can you show us the value of the ValueChangingFcn property of that slider before and after setting a value for the Tag property? I want to check that App Designer isn't trying to automatically update the value of the property to reflect the new Tag (if the name matches the default pattern that App Designer uses for that callback function) and so changing it to refer to a non-existent function.
Sherman Marcus
on 7 Oct 2024
Walter Roberson
on 7 Oct 2024
However, if I define Tag (e.g. 'abc' without the quotes)
I am concerned about that "without the quotes" part. Tags must be character vectors or string scalars. Unless you previously defined a variable as a character vector or string scalar, the Tag property would have to be set with apostrophes or double-quotes.
dpb
on 7 Oct 2024
I'll leave you in @Steven Lord's more than capable hands...I just built a two-component app to check; I have not built enough complicated-enough apps to have tried the single callback but I'm flabbergasted that the callback info does not identify the object that initiated the callback in either the app nor in the event structs other than by the subterfuge of having to match the 'Tag' property; I would have thought the object name itself would be there; it has to be known internally. That seems a big oversight/hole...
If @Steven Lord/Mathworks can't find a fix inside the existing .mlapp file using 'Tag', my thinking regarding the problem of starting with a clean app was that you don't just delete everything and start completely over but save all the code in another backup file and then can reinsert in rather than rewriting it.
The question would be at point in creating the UI/callbacks does it break again or is it clean the second go? Of course, if the workaround works, while klunky, "when in Rome...".
Good luck...
Stephen23
on 7 Oct 2024
"I am concerned about that "without the quotes" part."
The OP wrote "When I create a slider component in App Designer.."
When using App Designer the text is entered without quotes:

App Designer converts this to a character vector and sets the Tag property with it.
Sherman Marcus
on 7 Oct 2024
dpb
on 7 Oct 2024
Keep us posted if Mathworks comes up with a solution either here presuming @Steven Lord does continue to follow up--I would give that a while but if nothing happens, I still think this would be worthy of an official bug report
Sherman Marcus
on 8 Oct 2024
That is interesting observation and indeed undoubtedly there's something related somehow; those symptoms would seem to imply the conversion still leaves links to older code left over from GUIDE days despite all the visible user source code being in the new app designer interface.
I would think this would be of interest to Mathworks; I wonder if it is intended or an artifact of the translation that isn't doing what is expected. Or, maybe there's stuff buried so deep behind the scenes it simply isn't possible for the conversion app to be able to fix.
Does your UI rely on the 'Changing' callback to do something different than from the 'Changed' callback?
Sherman Marcus
on 8 Oct 2024
Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!