Is there a way to update input arguments from main app to dialogue app if the dialogue app is running in single instance?

1 visualización (últimos 30 días)
staurtupFcn is no more processed after first access to dialogue app and arguments are not updated according to following access from main app.

Respuestas (1)

Eric Delgado
Eric Delgado el 22 de Nov. de 2022
Yes. Just create a PUBLIC property or a public function in your dialogue app and call it everytime you change something in your main app. You can use try catch block or a handle validation.
% In your dialogue app - "dialogApp.mlx"
properties (Access = public)
myProperty
end
methods (Access = public)
function myPublicFunction(app, newValue)
app.myProperty = newValue;
end
end
% In your main app
properties (Access = private)
hWin = [] % handle to your dialogue window
end
% Callback for a pushed button, opening your dialogue window, for example
app.hWin = dialogApp(app);
% Changing a value in your dialogue windows from your main app
if ~isempty(app.hWin)
app.hWin.myPublicFunction(10);
end
% Or...
try
app.hWin.myPublicFunction(10);
catch
end
% Or...
try
app.hWin.myProperty = 10;
catch
end

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by