How can I get the index of the selected item in a pop-up menu within a uitable?
Afficher commentaires plus anciens
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.
Réponses (2)
Sean de Wolski
le 21 Août 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 commentaire
J. Jotakin
le 21 Août 2012
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!