Need a row-specifi or cell-specific context menu for uitable

3 vues (au cours des 30 derniers jours)
Evgeny Bespechansky
Evgeny Bespechansky le 4 Mai 2020
Modifié(e) : Divyanshu le 24 Sep 2024
I need to assign a row-specific or a column specific context menu for a uitable (within uifigure).
I know how to create a global context menu, but I need it to be different for every row (or cell) of the table.
Tricks with learning cursor position won't work, as the table is larger, than it is shown on the screen and I use sliders to navigate through it.
The Matlab version is 2020a.

Réponses (1)

Divyanshu
Divyanshu le 24 Sep 2024
Modifié(e) : Divyanshu le 24 Sep 2024
A possible way to achieve location specific context-menu opening through App designer is adding the following piece of code inside the callback function defined for 'ContextMenuOpeningFcn' property of 'uicontextmenu()':
row = event.InteractionInformation.Row;
col = event.InteractionInformation.Column;
app.currentRow = row;
app.currentColumn = col;
% The above piece of code enables you to track the row and column of a UITable which user
% has clicked or from which the context-menu is triggered.
I have used this code for version R2023b, there it works well but not sure if it will work for earlier versions of MATLAB.
Hope this helps!

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by