retrieving data from GUI table with pop-up menu

3 visualizaciones (últimos 30 días)
ariel
ariel el 19 de Nov. de 2017
Respondida: ariel el 20 de Nov. de 2017
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

Respuesta aceptada

ariel
ariel el 20 de Nov. de 2017
Success!
I used the CellEditCallback instead of CellSelection

Más respuestas (0)

Categorías

Más información sobre Simulink Environment Customization en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by