addlistener for an array

4 vues (au cours des 30 derniers jours)
rmc256
rmc256 le 30 Août 2011
In a GUI, I would like a function to be called whenever a certain variable stored in "handles" is changed (handles.times lets say). I tried using addlistener() directly on an array, which doesn't work. I think I can create a class and do it that way, but it seems like a lot. I'm looking for SPECIFIC examples. Reasoning for this is I have a GUI that is a slave GUI to a master GUI. Whenever a certain value changes in the slave, I want it to automatically update the master GUI.

Réponses (1)

Walter Roberson
Walter Roberson le 30 Août 2011
It might be easier to write a small wrapper routine such as
function handles = updatehandles(handles, field, value)
handles.(field) = value;
guidata(handles.mastergui, handles);
end
and then use updatehandles() instead of a plain assignment.

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by