필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 5월 1일
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

추가 답변 (1개)

Jonathan Wang
Jonathan Wang 2011년 4월 30일
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
Jonathan Wang
Jonathan Wang 2011년 5월 1일
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. :-)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by