Strange Behaviour of WindowsKeyPressedFcn and ButtonDownFcn on Mac
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Elco Bakker
am 31 Okt. 2017
Bearbeitet: Elco Bakker
am 14 Nov. 2017
This is a simple example of my problem:
f = figure;
f.ButtonDownFcn = @(src,event) fprintf('clicked\n');
f.WindowKeyPressFcn = @(src,event) fprintf('pressed %s \n',event.Key);
f.WindowKeyReleaseFcn = @(src,event) fprintf('released %s \n',event.Key);
if I hold down 'o' and click on the figure, they key press function seems to die (i.e. no longer activates) though the key release function and button down function still do. If I then hold down 'j' and double click on the figure, the key press function come back to life.
MATLAB 2015b MacOS 10.12.6 (16G29)
0 Kommentare
Akzeptierte Antwort
Jiawen Liu
am 9 Nov. 2017
Hi Elco,
I understand that you are facing an issue with using the "WindowKeyPressFcn" on Mac machine after holding down the key and clicking on the figure. I tried both the script you posted in the question and my own script, but I was not able to reproduce the issue on my system.
There is one fact worth noticing that the "WindowKeyPressFcn" callback executes whenever a key press occurs while the figure(or any of its childern) has focus.
If the issue still persists, please try to use an alternative callback function "KeyPressFcn" which could implement the similar functionality.
Please refer to the following link for more details:
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!