フィルターのクリア

Unable to get uifigure to focus programmatically

14 ビュー (過去 30 日間)
Megan Rutherford
Megan Rutherford 2021 年 3 月 1 日
編集済み: Shadaab Siddiqie 2021 年 3 月 4 日
I have a uifigure with a menu bar (Matlab 2020b). When I click on the menu bar, the uifigure looses focus. I have a uifigure windowKeyPress callback which requires the uifigure to be in focus to work. At the moment after selecting the menu bar, I have to click on the uifigure to make it regain focus. I would like to regain the figure focus programmatically without having to click within the uifigure. I have tried:
figure(hUIFigure)
However, this does not work.

回答 (1 件)

Shadaab Siddiqie
Shadaab Siddiqie 2021 年 3 月 4 日
編集済み: Shadaab Siddiqie 2021 年 3 月 4 日
From my understanding uifigure is loosing focus. Here is a potential work arounds:
%==== OPTION 1 ====
figure(app.UIFigure);
%==== OPTION 2 ====
app.UIFigure.Visible = 'off';
app.UIFigure.Visible = 'on';
This issue occurs because the MATLAB Window is created as a separate process.

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by