How can I get the index of the selected item in a pop-up menu within a uitable?
Mostra commenti meno recenti
I have set up a column as pop-up menu in my uitable as follows:
f=figure;
choices={'A' 'B' 'C' 'A'};
t=uitable(f,'ColumnFormat',{choices}, 'Data', {'';'';''} ,'ColumnEditable',[true]);
I would need to know the index of the selected item within my array choices in uitable's CellEditCallback. I.e., if the user selects 'C' from the menu, the index would be 3. The array of choices can have duplicate values, so I cannot simply use strcmp to match the selected value.
J.
Risposte (2)
Sean de Wolski
il 21 Ago 2012
Well written question
f=figure;
choices={'A' 'B' 'C' 'A'};
t=uitable(f,'ColumnFormat',{choices}, 'Data', {'';'';''} ,'ColumnEditable',[true],'celleditcallback',@(src,evt)disp(evt));
This should make it pretty clear.
1 Commento
J. Jotakin
il 21 Ago 2012
Categorie
Scopri di più su Interactive Control and Callbacks in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!