具有自动返回的应用程序
应用与auto-reflow预配置的应用程序类型that optimize the viewing experience by automatically adjusting the size, location, and visibility of the app content in response to screen size, orientation, and platform. Use apps with auto-reflow if you expect to run or share your apps across multiple environments or desktop resolutions.
什么是自动流?
应用with auto-reflow extend the existing auto-resize behaviors that are on by default in all App Designer apps. These apps detect and adapt to the available screen size when they are first displayed. Both 2- and 3-panel apps have a large flexible-size panel, intended for visualizations like plots. As the app changes size, the large panel grows or shrinks, depending on the space available.
当应用程序的大小超过特定的预定阈值时,应用程序中的面板会回换并重新排序以充分利用空间。当面板本身重新排序时,它们和它们中的组件会动态调整大小,而组件之间的额外空间也减少了。
When an app becomes very small, auto-resize stops eliminating whitespace and resizing components. This can put some components outside the visible part of the window. To access these components, set the可滚动
面板的财产'on'
。这使得必要时可以出现滚动条。
Create New App with Auto-Reflow
应用程序设计器开始页面包括可以创建具有自动加强和自动回流的新2面板和3面板应用程序的选项,以及用于指导应用程序构建的帆布交互。不需要其他代码来实现回流和调整大小的行为。
兑换Existing App to Use Auto-Reflow
您也可以通过扩展使用自动转移的现有应用兑换下拉菜单File部分帆布选项卡和选择2-Panel应用程序具有自动回流
or带有自动回流的3面板应用
。
当您将现有应用程序转换为具有自动返回的应用程序时,应用程序设计器:
使用
_ conconted
appended to the file name. Your original app file is not changed.自动将预配置的面板和网格布局添加到您的应用程序中,以提供自动回流并调整行为大小。
创建一个
Sizechangedfcn
回调函数以控制图形大小时的应用程序的布局。
在某些情况下,在应用程序设计器转换您的应用程序后,您可能需要更新回调代码或某些组件的位置。该表描述了您可能需要进行的一些调整示例。
症状 | 解释 | Suggested Action |
---|---|---|
Components overlap | 应用程序设计师试图维持组件的相对位置,但您可能需要进行一些较小的调整。 |
Adjust the position of components as needed. |
Callback code does not behave as expected | 当将预配置的面板添加到您的应用程序中时,应用程序中的组件的层次结构会更改。如果您的回调基于父母的参考组件,则可能需要更新它们。 |
更新回调中的组件的父。 |
ExistingSizechangedfcn UI数字上的回调不像预期 |
具有自动流量的应用程序生成自己的Sizechangedfcn 该图的回调。如果您的应用已经有一个Sizechangedfcn 该图的回调,App Designer将其从图中断开连接,但不会删除代码。 |
After your app has been converted, modify or remove theSizechangedfcn 与图形断开连接的回调。您可以将其分配给另一个容器组件,或者如果不再需要的话,则将其删除。 |
删除自动返流行为
您可以通过扩展现有应用程序从现有应用中删除自动流动行为兑换下拉菜单File部分帆布选项卡和选择App without Auto-Reflow
。
当您将具有自动回流的应用程序转换为无自动返回的应用程序时,应用程序设计器:
使用
_ conconted
appended to the file name. Your original app file is not changed.使用自动返回从应用程序中删除应用程序的预配置网格布局。
Removes the
Sizechangedfcn
回调函数用于控制使用自动reflf的应用程序布局。
Example: App with Auto-Reflow
该应用程序具有具有自动回流行为的面板中的组件。数据选择的控件将归属于左图,并将数据可视化归属于右图中的两个选项卡。运行应用程序并更改应用程序窗口的大小。该应用程序内容根据应用程序窗口大小进行调整和翻转大小。