Need a row-specifi or cell-specific context menu for uitable
4 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Divyanshu
2024-9-24
编辑:Divyanshu
2024-9-24
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!