question about when a callback function is supposed to be called.

1 view (last 30 days)
In my program, which is written in App Designer, I have a Text Edit Field which contains the path to my data directory.
One can edit the value in the field to ways.
Way 1 is to directly edit the value by clicking in the box and typing the new path
for Way 2, I have a button beside the text field that when clicked opens up a file dialog and allows the user to select a different directory.
If I edit the Text field directly by typing in it, the valueChanged callback is called correctly.
If I use the button and file dialog to change the directory, then the value that is shown in the text field changes to what was selected, but the valueChanged callback is NOT called.
It seems to me that if the value is changed, no matter how it was changed, then the callback should execute.
Is this behavior expected or is it a bug?

Accepted Answer

Walter Roberson
Walter Roberson on 8 Jun 2016
Callbacks are never called when a property value is set() or changed by using dot notation. A listener might be called when a property value is changed, but not a callback.
Callbacks are invoked upon click or upon keyboard action when the item has focus (depending on the variety of callback.)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by