pan cancels WindowKeyPressFcn callback...
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Razvan
am 10 Mai 2012
Bearbeitet: Chella
am 24 Jul. 2014
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
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Mai 2012
You are correct, pan does have that effect. Please see http://www.mathworks.com/matlabcentral/answers/30563-pan-mode-control-via-keyboard
3 Kommentare
Walter Roberson
am 10 Mai 2012
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.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!