Changing a popup menu by changing an edit text box

1 visualizzazione (ultimi 30 giorni)
Sorry for all the questions today guys, but I really appreciate all of your help. So I've learned how to change an edit text box by changing a popup menu but can't seem to figure out how to do the opposite. Is it possible that if someone changes the value of an edit text box, that my popup menu can change automatically? I would assume it'd be some sort of if statement that checks if the values are the same but that seems terribly inefficient so I am guessing I am wrong. Thanks again!

Risposta accettata

Sean de Wolski
Sean de Wolski il 18 Mag 2012
The edit uicontrol's callback function should get it's string and set something else in the popup.
More per comments
In this case you should use addlistener() to add a listener to the 'PostSet' 'string' event broadcasted by each edit box. The documentation for addlistener() is here:
The call would look something like this:
for ii = 1:numel(hEdit) %where hEdit is the vector of edit box handles
addlistener(hEdit(ii),'PostSet','string',@(src,evt)set(hPopUp,'value',1))
end
  17 Commenti
Sean de Wolski
Sean de Wolski il 21 Mag 2012
Yes. Switch the 'String' and the 'PostSet' in your calls to ADDLISTENER. (doc addlistener to see the correct syntax)
Adam Kaas
Adam Kaas il 21 Mag 2012
Thank you Sean! Still a couple bugs to work out but I should be good to go from here!

Accedi per commentare.

Più risposte (0)

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!

Translated by