Azzera filtri
Azzera filtri

How to automatic detect selections in different uitables, and clear the selections in some of the uitables? Thanks

3 visualizzazioni (ultimi 30 giorni)
Hi,
I meet some problems and wonder if you could help me out.
Suppose we have two uitable objects, say A and B, both visible all the time. Users could make selections in both A and B. The goals I try to reach are
1, how can I/code check/detect whether uses make selections in both A and B;
2, assuming users make selections in both A and B, users can clear their selections in uitable A using ctrl+click, but how can the code clear the selections in A automatically?
I have googled online for quite a while, but I have no luck out of it. could anyone nicely help me out? Thank you.
Jon

Risposta accettata

Teja Muppirala
Teja Muppirala il 1 Mag 2011
If you want to clear all the selections, you can redraw the table (h is the uitable handle):
tmp = get(h,'data');
set(h,'Data',[]);
set(h,'data',tmp);
clear tmp

Più risposte (1)

Jonathan Wang
Jonathan Wang il 30 Apr 2011
I think I sort of figure out how to do the first one in the old way:
set global flags in corresponding _CellSelectionCallback function for both A and B, we can simply check the flags to see if selections are made.
I still don't know how to clear selections user makes by the code....
  1 Commento
Jonathan Wang
Jonathan Wang il 1 Mag 2011
Thank you Teja and it works. My own tries did not have "set(h,'Data',[]);" step and that's why I failed to clear selections. Simple but useful trick. :-)

Accedi per commentare.

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by