double action of GUIDE adapted drop down menu callback
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
In my code, I still have some GUIDE-style callbacks of dropdown menus as follows (this is just example code):
% Value changed function: mydropdown_menu
function mydropdown_menu_Callback(app, event)
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, ~, handles] = convertToGUIDECallbackArguments(app, event);
value = get(hObject,'Value');
if value==7
warndlg('warning message');
end
guidata(hObject, handles);
end
The issue is: when I make choice of value 7, then 'warning message' is displaed as intended, however, when I make next choice of any other value, the 'warning message' is displayed again. I do not have such a problem in Appdesigner-style value changed callbacks. How can I solve this problem?
3 Commenti
Risposta accettata
G A
il 14 Giu 2023
Modificato: G A
il 14 Giu 2023
2 Commenti
Image Analyst
il 14 Giu 2023
Yeah, klunky/kludgy. It looks like this is a side effect of having it do a conversion of the GUIDE code. That's why I said to just create a new drop down native to App Designer and you won't have that problem. You'd just have two separate callbacks, or maybe you need just one of them like the ValueChanged event. Anyway, since you used my code, can you at least click the Vote icon for my answer. Thanks in advance. 🙂
Più risposte (1)
Image Analyst
il 13 Giu 2023
What if you add a "value changed callback" by right clicking on the dropdown list? Then have this
function mydropdown_menu_Callback(app, event)
displayedString = app.mydropdown_menu.Value
selectedIndex = app.mydropdown_menu.Item
if selectedIndex == 7
uiwait(warndlg('warning message'));
end
end
5 Commenti
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!