Monday, June 30, 2008

Frusting Flex problems solved #4 - preventing a DataGrid column from resizing

What a laborious problem this was!

I had set up a DataGrid that resized with the browser, and the user could also resize the column widths. However one column contained a button, and needed to not be resizable by the user or by browser resizing. But in practice, the button was resizing smaller and smaller every time the browser was resized. After many forum postings a solution was suggested(thanks VarioPegged) that is not the most elegant but works:

To recap, three steps must be followed:

1. add a dummy datagridcolumn to the far right of the datagrid that is not resizable and has a width of 0.
2. give the column you don't want to resize a minWidth value.
3. set up an updateComplete event handler on the datagrid, which resizes the button column and then calls validateNow() on the datagrid.

you can follow the newsgroup post on this issue here

Wednesday, June 18, 2008

dynamic text field part I - letter spacing

This blog has moved.
Just discovered that flash resets the author-time letter spacing of a dynamic textfield when the textfield's text is set in ActionScript.

To maintain the authortime
letter spacing settings of the textfield, you need to record the textfield's textformat, set the text, and then reset the textfield's textformat to what it was. For example, if your textfield's instance name is test:

var fmt:TextFormat = test.getTextFormat();
test.text="New text";

something to check is that if the textfield does not contain any text, the author-time TextFormat
letter spacing property is not recorded. So if you don't want your textfield to contain any text, make sure the textfield contains at least one space to ensure it maintains its author-time TextFormat letter spacing property.