App Designer: How to autoresize children in 2-panel reflow option

조회 수: 10 (최근 30일)
Daemonic
Daemonic 2020년 3월 28일
댓글: Daemonic 2020년 4월 19일
I have a 2-panel app. In the right panel I am displaying images. When I resize the window to be larger, the images stay bunched up in the smaller section of the total window. Likewise, if I make it smaller, the buttons and images are cropped rather than rendered to smaller dimentions.
Is there any way to auto-resize the images when the user changes the window dimensions? I know that in standard apps, the autoresizechildren option is on by default. However, this options is greyed out in the reflow panel apps, and I cannot figure out how to change the setting either in the component browser or in the createComponents function in the app itself.
Thank you.

채택된 답변

Alice
Alice 2020년 4월 17일
The property AutoResizeChildren is 'on' by default, so it is 'on' in the 2 panels of the app.
However, AutoResizeChildren doesn't resize the images. There are cases where it makes sense to resize the images, but others where it doesn't (e.g. if the image is used as a logo), so the choice was to not resize images.
(If you place the images in a standard app, you will see that the images also don't get resized)
One way to make the images resize as described is to place a GridLayout in the right panel, and place the images in the grid.
By default, the rows and columns are all sized to be '1x', so they will share the available space equally.
When the panel is resized, the images will be scaled up and down accordingly.
  댓글 수: 1
Daemonic
Daemonic 2020년 4월 19일
Wonderful. Thank you for taking the time to respond. Solution works perfectly.

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

추가 답변 (1개)

Melissa Williams
Melissa Williams 2020년 4월 17일
Hi,
The auto-resize children property behavior varies based on components and the app layout. Every effort is made to retain relative component positions. Images do not autoresize when the app resizes. The reason is so the image does not distort. Buttons will resize if aligned to other components that resize, like an Axes.
Depending on the components and layout you want, you should be able to manually add a grid to the panel and use that to resize the components.
  댓글 수: 1
Daemonic
Daemonic 2020년 4월 19일
Thank you for your response. The grid solution works great. Appreciate it.

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by