Filter löschen
Filter löschen

Unable to get uifigure to focus programmatically

14 Ansichten (letzte 30 Tage)
Megan Rutherford
Megan Rutherford am 1 Mär. 2021
Bearbeitet: Shadaab Siddiqie am 4 Mär. 2021
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.

Antworten (1)

Shadaab Siddiqie
Shadaab Siddiqie am 4 Mär. 2021
Bearbeitet: Shadaab Siddiqie am 4 Mär. 2021
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.

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by