window size in matlab's app designer

edit: attached the app
when designing an app in the app designer (2020b), the size of the window seems to vary when I run it in differen PCs. I mean the size of the window after running the app.
In some computers part of the app itself is cut and cannot be accessed by the user.
is there a way to fix this?
Nathan

4 Comments

Can you give more info on the app that you are creating, can you share it or a screenshot ?
However, did you try setting the property 'WindowState' to 'maximized' for app.UIFigure?
Nathan Blanc
Nathan Blanc on 16 Mar 2021
Edited: Nathan Blanc on 16 Mar 2021
I tried it now. it doesn't fix the issue-it enlarges the figure window but not the app interface itself I am attaching two screenshots of the app, one from my computer (where it works correctly) and one from a different computer where it works incorrectly.
I am getting the following warning:
Warning: 'SizeChangedFcn' callback will not execute while 'AutoResizeChildren' is set to
'on'.
not sure if it is related
Can you attach the app ?
Nathan Blanc
Nathan Blanc on 17 Mar 2021
Edited: Nathan Blanc on 17 Mar 2021
attached. note that this is only a part of the app- none of the buttons work. but the buttons are not the issue. also note that it might work well on your computer as it does on mine. the issue is that this is computer dependent.

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 16 Mar 2021
Edited: Adam Danz on 17 Mar 2021
From the component browser in AppDesigner, select the figure handle and check the Window Appearance & Position properties in the properties inspector.
If the WindowState is set to maximized or fullscreen then the AutoResizeChildren should be checked so that different the app components will maintain their relative positions with monitor sizes.
Update
You also need to make these changes in the startup function. This will allow the app to fully render before resizing the figure.
function startupFcn(app)
%app.UIFigure.WindowState='maximized'; % <--------- remove
app.System_Inert.Items = app.Material_list;
app.System_Reactive.Items = app.Material_list;
app.System_Reactive.Value = 'Water';
drawnow(); pause(.05) % <--------- add
app.UIFigure.WindowState='maximized'; % <--------- add
end

14 Comments

thank you Adam. it was already selected but still doesn't fix the issue.
Nathan
Could you attach the app?
attached to aghamarsh's thread
Nathan
Adam Danz
Adam Danz on 17 Mar 2021
Edited: Adam Danz on 17 Mar 2021
See update in my answer.
If you want the figure to be maximized you need to let it completely render first, hense the draw now, and then maximize it at the very end of the startup fcn.
Thanks a lot for your answer Adam. This still didn't solve the problem, the screen looks like this on a different computer
Hey, I see that the system properties tab is moved in your attached zip file. Please check the app view in the deisgn section.
Thank you for your answer Adhamarsh. I didn't understand you. could you explain more? what is moved and what should I check?
I think what Aghamarsh Varanasi is referring to is that the System properties panel in the app you attached is not positioned in the same location as in the image you shared > correct.PNG
oh dear god *facepalm* The one that i labelled as correct was another weird bug- another incorrect version. attached here is an actually correct version.
Nathan
The solution I offered fixed the problem on my end using matlab r2021a, windows 10, on my laptop monitor and my 2 external monitors, all of which are different sizes.
Could you explain (or share an updated screenshot) what's wrong after implementing the solution in my answer?
you can see the picture attached in my previous comment from march 17. notice how the "system properties" is smeared, one of the buttons jumped to the right, etc. this is just an example from one computer.
My guess is that this an issue with the "resize children" function. it seems it is not working well enough in some situations. is it possible for the app, rather than changing size, will become scrollable when the screen is minimized? i tried adding "scrollable" to the properties but this didn't seem to work properly either :/
many thanks for your help and patience
Nathan
Do you mean this image?
Are you sure you're not accidentally accessing multiple versions of the file?
I've attached the version I have after I've implemented the changes in my answer and this is how it appears in App Designer and when the app is initialized. If yours looks different in AppDesigner, we're working with different files.
Yes, I mean the picture you referenced. The files look identical in the app designer, but different when the app is intitialized. this is exactly my problem. we are looking at the same file, i just double checked.
btw in your screenshot from when the app is initlaized it seems that the buttons are "cut" on the right side. the "speaker" button for instance. if they are indeed cut then this is a similar problem. in my computer screen the buttons are not cut.
I see what you mean.
I played around with it a bit more and the repositioning is really buggy. For example, when I run the app attached in my comment above the app is maximized by the statup fcn and there are errors in component placement. Then I manually shrink the figure and the components do not resize, they are just cut off. But then when I manually expand the figure by draging a corner, the button resizing starts to take effect. I'd contact tech support and let us know what they say.

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 10 Mar 2021

Commented:

on 22 Mar 2021

Community Treasure Hunt

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

Start Hunting!