retrieving data from GUI table with pop-up menu

2 views (last 30 days)
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

Accepted Answer

ariel
ariel on 20 Nov 2017
Success!
I used the CellEditCallback instead of CellSelection

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!