KeyPressFcn and WindowKeyPresFcn unable to initiate a callback function, opens command window instead (2019b).

Hey there,
I'm trying to map a specific key to activate a callback within my matlab gui figure. However, whenever a key is pressed, this key is forwarded to the command window instead. I have already viewed the following answer, however this fix did not work (https://au.mathworks.com/matlabcentral/answers/385499-in-matlab-r2017a-how-do-i-change-the-focus-of-the-windowkeypressfcn-figure-callback-function-from). Any ideas about how to force the gui figure to remain in focus to actually call the callback function?
Cheers.

Réponses (1)

Bruno Luong
Bruno Luong le 14 Sep 2023
Déplacé(e) : Bruno Luong le 14 Sep 2023
My experience is that when you activate zoom/pan/rotate on the figure, then the WindowKeyPressFcn are changed by zoom and pan and the focus steel reveals that fact.
make sure then the interactive tools are off.

2 commentaires

Hey Bruno,
You were right on the money about the zoom disabling the KeyPressFcn. I managed to disable the listening handles and I was able to call my function.
Thanks heaps!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange

Produits

Version

R2019b

Question posée :

le 14 Sep 2023

Déplacé(e) :

le 14 Sep 2023

Community Treasure Hunt

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

Start Hunting!

Translated by