Effacer les filtres
Effacer les filtres

to write a code for esc key

15 vues (au cours des 30 derniers jours)
PA
PA le 7 Juil 2022
how to write a code for when we press the esc key from keyboard it close for uifigure

Réponses (1)

Prathamesh Kulkarni
Prathamesh Kulkarni le 7 Juil 2022
I understand you want to close uifigure after pressing escape key.
For that you can set the KeyPressFcn property of the uifigure as a function eg. keycall
and then check if the pressed key is escape, if it is then you can use close() command.
a = uifigure;
set(a,'KeyPressFcn',@keycall)
function keycall(a, e)
if isequal(e.Key, 'escape')
close(a);
end
end
  2 commentaires
PA
PA le 7 Juil 2022
Thanks and can i use keyReleaseFcn?
Prathamesh Kulkarni
Prathamesh Kulkarni le 7 Juil 2022
Modifié(e) : Prathamesh Kulkarni le 7 Juil 2022
Yes you can use key release function as well.
This documentation will give you idea about the feature and implementation of both functions.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Develop uifigure-Based Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by