retrieving data from GUI table with pop-up menu

3 ビュー (過去 30 日間)
ariel
ariel 2017 年 11 月 19 日
回答済み: ariel 2017 年 11 月 20 日
Hi.
I'm creating a GUI using GUIDE that has a table, whose first column format is a pop-up menu. In each pop-up menu there's a line "new label".
I want that every time the user picks "new label", a new dialog box will open, that would allow entering a new string and update the label list stored in handles.
I'm able to do something with cellSelectionCallback, but it only executes when I select a cell, not when I pick a value from the cell's pop-up menu. It seems the popupmenu1_callback never fires.
Also, there's not handle to a pop-up menu in the handles.
Attached is the code section in the cellSelection callback:
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to uitable1 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
CellChoice = eventdata.Indices;
Tiss = eventdata.Source.Data; % not working yet. unable to refer the new label choice as an event
TisChoice = Tiss{CellChoice};
if strcmp(TisChoice,'new label')
NewLabel = inputdlg('Please Enter the New Label Name');
handles.TissueDataBase(end+1) = NewLabel;
handles.uitable1.ColumnFormat = {handles.TissueDataBase(2,:),[]};
end
Kind regards,
Ariel

採用された回答

ariel
ariel 2017 年 11 月 20 日
Success!
I used the CellEditCallback instead of CellSelection

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Environment Customization についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by