--- In [email protected], "pbrendanc" <[EMAIL PROTECTED]> wrote:
>
> Alex,
> Thanks - I think that approach will require me to build multiple
> subgrids and treat each of these subgrid as a separate griditem -
thus
> creating additional nesting, rather than 1 large grid. I was hoping
for
> to avoid that - is there any other way to accomplish this (I suspect
> not).
Hi, Patrick;
You don't say what your component is, but I'm going to assume it's an
extended button. If you extend instead from a component that
supports
borderSides as a style (any container), you could try something like
this:
<mx:Style>
.topLeft{
borderColor:#000000;
borderSides: 'top left';
}
.topRight{
borderColor:#000000;
borderSides: 'top right';
}
.bottomLeft{
borderColor:#000000;
borderSides: 'bottom left';
}
.bottomRight{
borderColor:#000000;
borderSides: 'bottom right';
}
</mx:Style>
Then, in your script block:
for (var i:Number = 0; i<nrows; i++) {
var myGridRow:GridRow = new GridRow();
// for each col add child controls
for (var j:Number = 0; j<ncols; j++) {
var myGridItem:GridItem = new GridItem();
//even rows will be tops, even columns lefts
switch (true) {
case(i%2==0&&j%2==0):
myGridItem.styleName='topLeft';
break;
case(i%2==0):
myGridItem.styleName='topRight';
break;
case(j%2==0):
myGridItem.styleName='bottomLeft';
break;
default:
myGrid.styleName='bottomRight';
}//end switch
myGridItem.addChild (myBtn);
//Add cell to row
myGridRow.addChild (myGridItem);
} // end col loop
// Add row to grid
myGrid.addChild(myGridRow);
}