App Designer - 'Global' Callback

3 次查看(过去 30 天)
Kyle Steiner
Kyle Steiner 2019-9-26
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

回答(1 个)

Pranjal Kaura
Pranjal Kaura 2021-7-28
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.

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by