Pop-Up Menu:
The Value property of these objects is used to determine which of the selected items are in the popup menu objects. The coding example is shown below.
function popupmenu1_Callback (hObject, eventdata, handles)
val = get (hObject, 'Value');
switch val case 1% Actions to be performed when the first item is selected
case 2% Actions to be performed while the second item is selected
% Callback block continuation and other commands
If the programmer wants to learn the string of the selected item, the following command lines can be used:
function popupmenu1_Callback (hObject, eventdata, handles)
val = get (hObject, 'Value');
string_list = get (hObject, 'String');
selected_string = string_list {val}; % Cell sequence translation
% to string
% Callback block continuation and other commands
The Value property of these objects is used to determine which of the selected items are in the popup menu objects. The coding example is shown below.
function popupmenu1_Callback (hObject, eventdata, handles)
val = get (hObject, 'Value');
switch val case 1% Actions to be performed when the first item is selected
case 2% Actions to be performed while the second item is selected
% Callback block continuation and other commands
If the programmer wants to learn the string of the selected item, the following command lines can be used:
function popupmenu1_Callback (hObject, eventdata, handles)
val = get (hObject, 'Value');
string_list = get (hObject, 'String');
selected_string = string_list {val}; % Cell sequence translation
% to string
% Callback block continuation and other commands
Yorumlar
Yorum Gönder