필터 지우기
필터 지우기

How to detect Ctrl+Click in uitable's CellEditCallbackFcn?

조회 수: 9 (최근 30일)
Stephan Heise
Stephan Heise 2013년 6월 20일
Hi,
I have a uitable in a GUI. One column format is logical, i.e. Matlab displays checkboxes in that column.
I would like to be able to distinguish whether a user clicks or ctrl-clicks (i.e. holds down the CTRL key while clicking) a checkbox while evaluating the uitable's CellEditCallbackFcn.
I could imagine utilizing the uitable's KeyPressFcn for this purpose but I bet there is a more elegant solution, maybe using the uitable's underlying java object? Haven't found anything so far, so any help is appreciated!
Thanks! Stephan.

답변 (2개)

Stan
Stan 2013년 6월 20일
As far as I know it is the KeyPress as you mentioned. Never saw an alternative.

Stephan Heise
Stephan Heise 2013년 6월 21일
OK. Thanks!
In the KeyPressFcn I now store the last pressed key in the GUI's appdata and in the uitable's CellEditCallback read it and check whether this was 'control'. That's kind of OK. But in the CellEditCallback I cannot tell when the control key was pressed; i.e. I can't distinguish whether the control key was pressed while the user clicked or whether it was pressed hours ago, can I?
  댓글 수: 1
Tom
Tom 2013년 6월 21일
편집: Tom 2013년 6월 21일
I was playing with this earlier - I couldn't find a way to get around this. The closest I got was using the window button motion function to clear the previous key press info but this wasn't perfect either. Maybe using the listbox option for the table cell would be better?

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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by