App UIFigure Visibility Bug

33 次查看(过去 30 天)
Mehdi Ansarey
Mehdi Ansarey 2023-10-26
回答: Sreeram 2024-8-9,3:05
I have Multi-Windows Application written with GUIDE. Currently I Tried to Migrate to App Designer.
My Problem: I Design An App, That Its Visibility Turned Off In App Startup Callback.
In Some Place, I Change The Position of That Windows (In Other Program Module), But Before User Decide to Click A Menu to show That App.
Its Very Odd That, The Windows Appears As Soon As Position Changed. I Tried to Turn It Visiblity Back to Off Again After Position Change Line. But It Didnt Work. Also Functions Like drawnow not useful (At First I Thought It is An Incomplete rendering problem).
This Is Secondary Windows That Should Be Invisible (app2):
function startupFcn(app)
app.UIFigure.Visible= "off"
end
In Master App, I Define ap2 Public Variable:
function startupFcn(app)
app.ap2= app2
end
And This Is Position Change In Some Callback That Tend To Show app2:
function ChangePositionButtonPushed(app, event)
app.ap2.UIFigure.Position= [100, 100, 1000, 700];
app.ap2.UIFigure.Visible
end
As you see, The 2nd Line Echo "off" Value for ap2.UIFigure, While It is shown.

回答(1 个)

Sreeram
Sreeram 2024-8-9,3:05
Hi Mehdi,
I understand that app2 becomes visible when its position is altered from the master app, even though its “Visible” property is set to “off”. I was able to reproduce the issue in MATLAB R2023b.
I have verified that this issue is not present in MATLAB R2024a. If you wish, you may upgrade to the latest MATLAB version.
You can work around the issue in MATLAB R2023b by toggling visibility to “on” and then back to “off” right after updating its position:
app.ap2.UIFigure.Visible = "on";
app.ap2.UIFigure.Visible = "off";
However, the UI figure might still be briefly displayed on the screen before getting hidden.
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by