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

3 visualizaciones (últimos 30 días)
Evgeny Bespechansky
Evgeny Bespechansky el 4 de Mayo de 2020
Editada: Divyanshu el 24 de Sept. de 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.

Respuestas (1)

Divyanshu
Divyanshu el 24 de Sept. de 2024
Editada: Divyanshu el 24 de Sept. de 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!

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by