Mapping Mouse Coordinates to GUI Components

Hi there,
I'm working on adding unique mouseover messages for every row in a uitable which is dynamically generated. I've been able to kind of hack it by creating a CellEditCallback and simply setting TooltipString based on the box checked. This is not a very "natural" way to use the mouseover though, and ideally I would like the user to be able to instead hover over the RowNames and see my unique TooltipStrings.
Now I'm trying to use a ButtownDownFcn callback so when the user right-clicks on the RowName I can toggle the TooltipString. The callback works, and I can get the mouse position in (x,y) no problem using:
mouseCoords = get(hobject.Parent.Parent,'CurrentPoint');
But I'm not sure how to map these coordinates to items on my screen? In some cases the UITable can have up 100+ rows, so using the scrollbar could make it look like the mouse coordinates are at the top of list when actually it's somewhere in the middle (if scrolled down when right click happens).
The code as is (not my authoring, and major rewrite is not an option as it's in production) utilizes a cell array of logic values for the table elements, and my CellEdit approach was changing tooltip based on element whose logic value changed. Unfortunately, there is no such logical toggling on Row elements (meaning, theres no property of uitable rows that seems to hold state or enable interaction) so my ability to hook into ButtownDownFcn when user right clicks on a RowName is kind useless unless I can map mouse coordinates?
Is there a way to map coordinates with scrolling on? Or is there a way I can make the row elements in the uitable be interactive?
Not using any GUI editors, just editing .m files. Any help is greatly appreciated!

Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Products

Release

R2018b

Asked:

on 6 May 2020

Edited:

on 6 May 2020

Community Treasure Hunt

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

Start Hunting!