creating callback for each string of a popupmenu in GUI
Mostra commenti meno recenti
%I have a popupmenu in GUI and I created 3 strings (x,y,z) in this popupmenu. I need to create callback for each 3 strings. Each string has different codes so when user click one of them, related popupmenu's codes need to work.
Risposta accettata
Più risposte (1)
Robert Cumming
il 5 Lug 2014
Create a single callback for the popupmenu then switch inside that callback based on which string is selected, i.e.
function popupCallback ( obj, event )
str = get ( obj, 'string' );
val = get ( obj, 'value' );
switch str{val}
case 'str1'
callbackItem1 ();
case 'str2'
callbackItem2 ();
case 'str3'
callbackItem3 ();
end
end
Categorie
Scopri di più su String in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!