MATLAB Answers

How to let user update popmenu string and add some code in popmenu?

1 view (last 30 days)
Lai man
Lai man on 16 Oct 2018
Edited: Lai man on 16 Oct 2018
When I push one radiobutton the edit_text(add one selection to my popmenu string) and button(confirm adding) it will display(already does), so I need to increase my switch case or change some thing in popmenu code when user increase one popmenu opotion does it possibility? (my english is poor sorry)
ex:
before
contents = get(hObject, 'Value');
switch contents
case 1 return 1;
end
user add one
after
contents = get(hObject, 'Value');
switch contents
case 1 return 1;
case 2 return 2;
end
Does it possibility?

  4 Comments

Show 1 older comment
Lai man
Lai man on 16 Oct 2018
like that(when user click radio button) but I have edit_text(I can type thing in here to edit new option name) when I press pushbotton(confirm to add one), and menu will have new option and my popmenu code it can be edit(I want to let user edit new case code). (thanks to reply
Walter Roberson
Walter Roberson on 16 Oct 2018
after
contents = get(hObject, 'Value');
switch contents
case 1 return 1;
case 2 return 2;
end
Why not just return what is in contents ?
Note: you cannot return anything from these kinds of callbacks; you can only store a value somewhere that other code can find the value.
Lai man
Lai man on 16 Oct 2018
I know how to do, I am fixate on using switch case and I forget contents it will be change .... (thanks for your help and reply

Sign in to comment.

Answers (0)

Sign in to answer this question.

Tags


Translated by