필터 지우기
필터 지우기

pan cancels WindowKeyPressFcn callback...

조회 수: 2 (최근 30일)
Razvan
Razvan 2012년 5월 10일
편집: Chella 2014년 7월 24일
Hi,
I noticed that after using the pan function, WindowKeyPressFcn callback doesn't work anymore...
Example:
function someFunction
Fig = figure('WindowKeyPressFcn', @buttonPressed_Callback);
plot(rand(1,10))
pan on
function buttonPressed_Callback(handle, event)
key = event.Key
end
end
How can I reactivate the WindowKeyPressFcn callback after the pan command?
Thanks,
Razvan

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 10일
You are correct, pan does have that effect. Please see http://www.mathworks.com/matlabcentral/answers/30563-pan-mode-control-via-keyboard
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 5월 10일
1) *First* turn on pan.
2) Then turn off the listeners as shown at https://groups.google.com/group/comp.soft-sys.matlab/msg/db42cf51392b442a
3) Then set() your desired function as the WindowKeyPress callback.
4) When it is time to turn pan off, reverse the order: set() the WindowKeyPress callback to what it would normally be, then re-enable the listeners, then turn pan off.
addlistener() is not involved in this process: you need to disable the listeners instead as the listeners are blocking you from adding your own WindowKeyPress callback.
Chella
Chella 2014년 7월 23일
편집: Chella 2014년 7월 24일
I know this is an old thread but it helped me out. In addition to step 3) I also have to set KeyPressFcn = [] to avoid keystrokes getting back to Matlab command window.
Thanks

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 5월 10일
Hi Razvan,
I think this thread might interest you:
  댓글 수: 1
Razvan
Razvan 2012년 5월 10일
Thanks, but I couldn't solve this problem yet.
Razvan

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

카테고리

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