App Designer - 'Global' Callback

2 vues (au cours des 30 derniers jours)
Kyle Steiner
Kyle Steiner le 26 Sep 2019
I'm building a GUI in the App Designer for the first time (screenshot below).
This is to control a phased array antenna for research in my graduate program. I provide user control of the phase, attenuation, polarity, and enable for each element as well as beamforming synthesis.
I'd like to have a table which updates for any user interaction event, so the user can see what commands will be sent to the array (table is in the upper right of the screenshot). However, I don't see a way to create a global callback function that will execute for any user interaction.
I saw this example (https://www.mathworks.com/help/matlab/creating_guis/share-callbacks-between-components-in-app-designer.html), which allows a single callback to be controlled by multiple components. But it appears that a given component can only be tied to one callback.
My workaround is to create an update_table function which I would include with every callback. However, this feels a bit cumbersome.
Is there a way to execute a code snippet for a global event - ie. any time the user clicks a butten or enters text in the GUI? All the callback options I'm seeing pertain to a particular component.
Thank you,
Kyle

Réponses (1)

Pranjal Kaura
Pranjal Kaura le 28 Juil 2021
Hey Kyle,
It is my understanding that you want to develop a callback that is activated whenever the user interacts with the GUI. You do not want to use component wise callbacks.
You could refer to the Write Callbacks for Apps page and look at the:
  1. WindowButtonDownFcn: End user presses a mouse button while the pointer is in the figure window.
  2. WindowKeyReleaseFcn: End user releases a key while the pointer is on the figure or any of its child objects.
This could be a workaround to create the 'global' callback function that you need. The update_Table function could then be added to these callbacks.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by