enable context menu for specific cell or item in uitable or uilistbox in matlab
Show older comments
This is a cross posting from:
Had no luck there so far.
Basically, I'd like to know how to get a context menu to fire on a specific item in a uitable or uilistbox. There seems to be no way to do this without first click on an entry, and then right clicking at the exact same location and assuming that the user hasn't moved their mouse. Even this double clicking approach (left, then right) would be super awkward.
Accepted Answer
More Answers (1)
Jasmine Poppick
on 20 Sep 2023
4 votes
Starting in R2023b, you can use the InteractionInformation property of the ContextMenuOpeningFcn callback event data to query the table cell or listbox item that was right-clicked to open the context menu, and then show or hide the context menu based on whether you want the menu items to appear.
Here is an example in the documentation that shows how to selectively show a context menu on certain parts of a table.
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!