to write a code for esc key
15 ビュー (過去 30 日間)
古いコメントを表示
how to write a code for when we press the esc key from keyboard it close for uifigure
0 件のコメント
回答 (1 件)
Prathamesh Kulkarni
2022 年 7 月 7 日
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 件のコメント
Prathamesh Kulkarni
2022 年 7 月 7 日
編集済み: Prathamesh Kulkarni
2022 年 7 月 7 日
Yes you can use key release function as well.
This documentation will give you idea about the feature and implementation of both functions.
参考
カテゴリ
Help Center および File Exchange で Develop uifigure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!