MATLAB: How to tell how an uieditfield was exited

app designerMATLABuieditfield

I have a uieditfield field for text input.
There seem to be at least three ways to indicate to the app that we are finished entering information into this field. The ValueChangedFcn is called when (1) the user presses Enter, (2) the user presses Tab, or (3) the user changes from the app to another program running on the computer.
Is there a way to figure out which of these three events occured? In particular, I'd like to catch (3) and ignore processing the current value of the field for the moment.

Best Answer

I might be wrong, but you could try getting the CurrentKey property of the figure
function editFieldValueChangedCallback(src,evt)
fig = ancestor(src,'figure');
switch get(fig,'CurrentKey')
case 'return'
disp('enter was pressed!')
otherwise
disp('the user changed focus!')
end