How can I use Menu bar for multiple options check?

5 Ansichten (letzte 30 Tage)
Adrian Quesada
Adrian Quesada am 24 Jun. 2019
Kommentiert: Adrian Quesada am 4 Jul. 2019
Hi all
I am trying to create an app on the App Designer.
This app will have the option to be in English and Spanish, so the user may choose the language.
To do this I use the Menu Bar, one option for Spanish and another to English, but when I choose option 1 the option 2 sometimes doesn’t un check or If I check option 2 it doesn’t do anything.
I don’t know what is wrong with the code, I would like that only one option may be checked at time and only when the option is clicked.
This is my code:
app.SpanishMenu.MenuSelectedFcn = @ShowCheck;
function ShowCheck(src,event)
if strcmp(app.SpanishMenu.Checked,'on')
app.SpanishMenu.Checked = 'off';
app.EnglishMenu.Checked = 'on';
disp(app.PropiedadesdelAguaPanel.Title);
set(app.PropiedadesdelAguaPanel, 'Title', 'Water Properties')
set(app.TemperaturaDropDownLabel, 'Text', 'Temperature')
else
%strcmpi(app.EnglishMenu.Checked,'on')
%app.EnglishMenu.Checked.Checked = 'on';
app.SpanishMenu.Checked = 'on';
%app.EnglishMenu.Checked = 'off';
set(app.PropiedadesdelAguaPanel, 'Title', 'Propiedades del Agua')
set(app.TemperaturaDropDownLabel, 'Text', 'Temperatura')
end
end
  4 Kommentare
Luna
Luna am 2 Jul. 2019
Will you be able to upload as attachment your whole code for me to run?
Adrian Quesada
Adrian Quesada am 4 Jul. 2019
Thanks for your help.
Enclosed you will find the app file.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by