App UIFigure Visibility Bug

14 views (last 30 days)
Mehdi Ansarey
Mehdi Ansarey on 26 Oct 2023
Answered: Sreeram on 9 Aug 2024
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.

Answers (1)

Sreeram
Sreeram on 9 Aug 2024
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.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!