App Designer - Screen resolution

조회 수: 29 (최근 30일)
Gabriela
Gabriela 2017년 7월 3일
답변: Arsalan jamialahmadi 2019년 7월 15일
I have an app with 3 tabs and several graphs on each tab built in the app designer (not GUIDE). When I connect my laptop to a screen with resolution 1920x1080 I can see the app perfectly, but when using my laptop screen (1366x768) one third of app is not visible.
I see there are some commands to get the screen size [ie get(0,'ScreenSize')] but not sure where to use this command in the app designer so that when I open it, I can visualize it correctly no matter the screen resolution of the computer. Thanks!
  댓글 수: 3
Gabriela
Gabriela 2017년 10월 13일
I tried 2 solutions but none worked for me:
1) Resizing in the start up function (as suggested below) works but you have to do it for every component in the app, which it's ok if you have a couple, but I have many.
2) I tried adding a slider component with a callback that "moved" the screen. This used to work for GUI (see https://nl.mathworks.com/matlabcentral/answers/97964-how-can-i-use-scrollbars-in-matlab-figure-windows-when-viewing-large-guis). But the slider in app designer is not really a scrollbar. In my case I had one horizontal slider and one vertical. When I moved up the horizontal slider became invisible. Same happened to the vertical slider when I moved left. Thus I could not see the first quadrant of the app. If somebody knows a way of "fixing" the sliders so that they are always visible that would be great.
This is something Matlab should improve. Or at least bring back the good old GUI sliders.
If you want to try resizing, add a start up function to the app, and in the function get the current screen size with get(0,'ScreenSize') and add a condition to adapt the size of the app proportionally to the size of the screen. Then use the Position property to change the size: app.(appname).Position = [100 100 proportionalWidth proportionalHeight]
Chong Cao
Chong Cao 2017년 11월 2일
same problem, dont know how to due with

댓글을 달려면 로그인하십시오.

답변 (3개)

Melissa Williams
Melissa Williams 2018년 12월 12일
Hi Gabriela,
Starting in R2018b, you can turn Scrollable on the UIFigure and you should be all set, no need to calculate screen size or manually add sliders.
  댓글 수: 4
Giada Staniscia
Giada Staniscia 2019년 6월 28일
I still have the exact same problem in R2019a.
Melissa Williams
Melissa Williams 2019년 6월 28일
The app will launch at the size you set for the UIFIgure, unless you write code to make it smaller. But if you make the app smaller the components inside it should automatically resize and reposition themselves. Make sure autoresize children property is on for your figure and tabs.

댓글을 달려면 로그인하십시오.


Sally Al Khamees
Sally Al Khamees 2017년 7월 13일
Hi Gabriela, You might want to try writing a callback that activates when the app is loaded.See the customer the following link for more details.
I hope this helps
  댓글 수: 3
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja 2018년 11월 30일
편집: Bhavanithya Thiraviaraja 2018년 11월 30일
get(groot,'Screensize')
Joseph Santoro
Joseph Santoro 2019년 7월 12일
I would love to try this solution since I am experiencing the same problem in 2016a but I have no option to create a StartupFCN callback function on my UIFigure. Please see the attached screenshot. Any idea why this is happening?matlab-request.jpg

댓글을 달려면 로그인하십시오.


Arsalan jamialahmadi
Arsalan jamialahmadi 2019년 7월 15일
Hi Gabriella,
I used to have exact same problem but eventually could solve it.
What I think should be better documented is the fact that every thing you create in a page in your App Designer needs to be put inside a panel, otherwise auto resize function does not work properly. You also need to be very careful with the "Inner" size of panels and not place any control interfering with this area.
So for me it works by applying above formula plus making the "Scrollable" and "AutoResizeChildren" checked for all controls including the main page of my app.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by