I see that Flex3 has a class called ApplicationControlBar
dedicated to "holding components that provide global navigation and application commands." (quoted from the langref). The question is: is there an advantage of using this class instead of just adding a plain HBox
with a greyish background, or is it just a matter of taste?
我看到Flex3有一个名为ApplicationControlBar的类,专门用于“保存提供全局导航和应用程序命令的组件”。 (引自langref)。问题是:使用这个类是否有优势,而不仅仅是添加一个带有灰色背景的普通HBox,或者仅仅是品味问题?
In my current code, I use the following box:
在我当前的代码中,我使用以下框:
<mx:HBox verticalAlign="middle" horizontalGap="5" backgroundColor="0xCCCCCC"
width="100%" paddingTop="5" paddingRight="5" paddingBottom="5"
paddingLeft="5">
Granted, this requires explicitly specifying a few attributes, but other than that?
当然,这需要明确指定一些属性,但除此之外?
3 个解决方案
#1
ApplicationControlBar is essentially an HBox with both scroll policies set to false and a transparent background. The only other feature it offers is the ability to be docked. From the Livedocs:
ApplicationControlBar本质上是一个HBox,滚动策略设置为false,透明背景。它提供的唯一其他功能是能够停靠。来自Livedocs:
Docked mode: The bar is always at the top of the application's drawing area and becomes part of the application chrome. Any application-level scroll bars don't apply to the component, so that it always remains at the top of the visible area, and the bar expands to fill the width of the application. To create a docked bar, set the value of the dock property to true.
停靠模式:栏始终位于应用程序绘图区域的顶部,并成为应用程序镶边的一部分。任何应用程序级别的滚动条都不适用于组件,因此它始终保持在可见区域的顶部,并且条形扩展以填充应用程序的宽度。要创建停靠栏,请将dock属性的值设置为true。
If you look at the source for ApplicationControlBar and Application.dockControlBar you'll see that when docked=true the bar is added to rawChildren instead of children which is what allows it to "ignore" scollbars and such.
如果你查看ApplicationControlBar和Application.dockControlBar的源代码,你会看到当docked = true时,bar被添加到rawChildren而不是child,这是允许它“忽略”scollbars等的。
#2
In addition to the previous answer I can add, that it's possible to set the gradient background to the ApplicationControlBar, which is not allowed to the HBox, if you're not using the special border type, of course :)
除了我之前的回答,我可以补充说,如果你没有使用特殊的边框类型,可以将渐变背景设置为ApplicationControlBar,这是不允许的HBox,当然:)
#3
But even with HBox you can still draw your own gradient background without setting the border style.
但即使使用HBox,您仍然可以在不设置边框样式的情况下绘制自己的渐变背景。
#1
ApplicationControlBar is essentially an HBox with both scroll policies set to false and a transparent background. The only other feature it offers is the ability to be docked. From the Livedocs:
ApplicationControlBar本质上是一个HBox,滚动策略设置为false,透明背景。它提供的唯一其他功能是能够停靠。来自Livedocs:
Docked mode: The bar is always at the top of the application's drawing area and becomes part of the application chrome. Any application-level scroll bars don't apply to the component, so that it always remains at the top of the visible area, and the bar expands to fill the width of the application. To create a docked bar, set the value of the dock property to true.
停靠模式:栏始终位于应用程序绘图区域的顶部,并成为应用程序镶边的一部分。任何应用程序级别的滚动条都不适用于组件,因此它始终保持在可见区域的顶部,并且条形扩展以填充应用程序的宽度。要创建停靠栏,请将dock属性的值设置为true。
If you look at the source for ApplicationControlBar and Application.dockControlBar you'll see that when docked=true the bar is added to rawChildren instead of children which is what allows it to "ignore" scollbars and such.
如果你查看ApplicationControlBar和Application.dockControlBar的源代码,你会看到当docked = true时,bar被添加到rawChildren而不是child,这是允许它“忽略”scollbars等的。
#2
In addition to the previous answer I can add, that it's possible to set the gradient background to the ApplicationControlBar, which is not allowed to the HBox, if you're not using the special border type, of course :)
除了我之前的回答,我可以补充说,如果你没有使用特殊的边框类型,可以将渐变背景设置为ApplicationControlBar,这是不允许的HBox,当然:)
#3
But even with HBox you can still draw your own gradient background without setting the border style.
但即使使用HBox,您仍然可以在不设置边框样式的情况下绘制自己的渐变背景。