Thursday 6 March 2008

States, containers & design mode

Came across an annoying little glitch in flex builder today. If you have a basic application that say has 2 states and the base state contains a VBox componant, it can be difficult to add a new item to the VBox in the second state in design mode.

By default the VBox does not contain any height information, it just takes it's size from the items that are added to the cells of the container. In my application I have an HBox in the top cell and I wanted to add a label to the next VBox cell in the second state. What happens is that you cannot see any visual hint to show you that you are placing your item in the next cell of the VBox (this usually is shown by a blue horizontal line being displayed in the VBox when you drag an item into a potential cell area).

The solution is to go back to your Base State and give the VBox a height value, then go to the state you wish to add your item and you will now see a blue line appear. Once placed you will need to go back to your Base State and remove the height value.

No comments: