uitable CellSelectionCallback on mouse RELEASE not click

9 visualizzazioni (ultimi 30 giorni)
Hi,
I'm having trouble with the uitable callback in my Matlab GUI.
I'm having the user load in some data to a backend strucutre, then I take some info from that data and place it in a uitable in the GUI. Then when the user selects some of the data in the table I want to automatically plot the corresponding data from the database.
When the user selects just 1 row everything works fine.
However when the user drags the mouse to select multiple rows in the uitable, the plot function is running at every change to the selection. I dont want that, I want to code to run only when the user relased their mouse button and completes their selection.
The data is fairly large so it takes 0.5s or so to plot each dataset. So imagine the user wants to plot 5 dataset. They click on the table and drag their mouse across 5 rows, as they select 1 it plots 1 dataset, then a fraction of a second later their curser reaches the 2nd row and it plots the first dataset again and adds the second. Then when their mouse reaches the 3rd row, the plot is cleared and datasets 1, 2 and 3 are all plotted. Its very ugly to see and it's slowing the code down.
Is there anyway to only run the code on the release of the mouse button?
Something like:
function uitable_Database_CellSelectionCallback(hObject, eventdata, handles)
if ~mouseclick()
PlotData
end
or is there a way I can triggar a callback only once the users selection from the uitable is complete, not while they're still making a selection?
  3 Commenti
Richard Genik
Richard Genik il 15 Set 2021
Yeah, this is a problem... have the same issue.
Adam Danz
Adam Danz il 15 Set 2021
I agree it would be nice to have a mouse button-up callback response.
If the callback function is short/fast, just allow it to update as the user drags the mouse and selects more cells. If the callback function is slow, perhaps you could add a button to start the process after selection is complete.
Another idea is to use a CellSelectionCallback function to merely store the most recent selection as a property in the app and then use a KeyReleaseFunction to evoke the callback function. You can select a key (e.g. 's', shift, alt, etc) that the user woulud hold down to make the selection and upon release, the callback function accesses the most recent cell selection. It's not idea, but it's a workaround.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su App Building in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by