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.

Answers (1)

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 Comments

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!

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Release

R2019b

Asked:

on 14 Sep 2023

Moved:

on 14 Sep 2023

Community Treasure Hunt

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

Start Hunting!