How to detect if passed handle is a handle to an App Designer Application
Show older comments
Background
I have a function which I'm calling from multiple other functions that takes in a Handle to an object, and then returns the properties of that object in a struct to make a copy of it's properties (e.g. the data for a graph in a figure) for later reference in case the handle becomes invalid. Some of these objects may contain large sets of data, and may take a long time to process. The handle it is passed could be almost any object, but if it is a handle to a Figure, a UI Figure, or an App Designer application, I want to be able to use a progress bar.
Issue
If it's a handle to a figure or UI figure, it's easy enough for me to check its class and use the appropriate progress bar with the figure. If it's a handle to an App, however, I have to use the underlying top level UIFigure for the progressbar. The issue is, using class on the App handle returns the name of the App. I intend on making multiple apps that could be referenced, so I don't want to have to keep manually updating the function with each new App I create. Not to mention, I may want to share the code with people / create an internal library where others may have their own Apps with arbitrary names - so it needs to know it's an "App" without knowing what names the App might have. There's no isApp function or equivalent that I'm aware of. I also can't just assume that if it has a UIFigure as a top-level child that it is an App (there are a few odd situations where this may not be the case).
Question
So, the ultimate question here is, how do I test a handle to verify that it is a handle to an App Designer Application?
Accepted Answer
More Answers (1)
Kevin Holly
on 4 Jan 2023
Edited: Kevin Holly
on 4 Jan 2023
metaclass(app).Description
Should return 'Properties that correspond to app components' if it is an app.
where the input "app" in the above function is the handle of the app.
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!