In many cases it is possible to layout components using one of the simple layout approaches implemented in the HBox, VBox, Tile or Form containers. When a more advanced layout is needed the obvious choices are Grid and Canvas (using enhanced constraints).
The Grid provides the ability to position components in rows and columns, setting the size of the rows and columns to fill extra space as desired and setting rowSpan and columnSpan properties on the items to create complex arrangements.
The Canvas, when set to layout="absolute" supports a new approach called "Enhanced Constraints" through the use of constraint columns and constraint rows. This allows components to be anchored to the container as well as to virtual rows and columns which can be sized explicitely, by percent or according to the components within them.
If you do some research (specifically: http://bugs.adobe.com/jira/browse/SDK-12941) you will find that Grid was initially deprecated in the Flex 3 beta 2 release, but that decision was reversed before the production release of Flex 3. In the bug comments it is noted that there are no current plans to deprecate or remove Grid but it is obvious that the Flex team believes that Enhanced Constraints represents the future direction of Flex layout.
After some experimentation it appears that the Enhanced Constraints feature is not fully production ready. In several cases it was observed that components did not fill extra space or line up as specified in the constraints. It is possible that my tests were not making proper use of the new functionality, only a careful walk through the CanvasLayout.as source will verify the source of the problem. I have filed one bug at this point and will add more later http://bugs.adobe.com/jira/browse/SDK-15746.
At this point it makes sense to favor Grid for advanced layouts but in time the Enhanced Constraints feature will probably overtake Grid.
6.05.2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment