Changing a popup menu by changing an edit text box

3 Ansichten (letzte 30 Tage)
Adam Kaas
Adam Kaas am 18 Mai 2012
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!

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 18 Mai 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 Kommentare
Sean de Wolski
Sean de Wolski am 21 Mai 2012
Yes. Switch the 'String' and the 'PostSet' in your calls to ADDLISTENER. (doc addlistener to see the correct syntax)
Adam Kaas
Adam Kaas am 21 Mai 2012
Thank you Sean! Still a couple bugs to work out but I should be good to go from here!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by