I didn't run this example.  I will later if I get time.  I'm surprised the 
checkbox centers.  textAlign is for text and the checkbox icon isn't text and I 
don't think there's code in there that uses textAlign to position the checkbox. 
 In theory, the centering trick on my blog should be what you need.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of aceoohay
Sent: Thursday, March 12, 2009 7:29 PM
To: [email protected]
Subject: [flexcoders] Re: Checkbox Itemrenderer centering mystery...


I am not sure of your usage of the term drop-in, but the following is code that 
works in a test environment, but substantially similar code fails in a more 
complex environment.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
xmlns:inp="Classes.Input.*">
<mx:Component id="itmTest">
<mx:CheckBox selected="{(da...@istrue == 'true')?true:false}" 
click="{da...@istrue = (da...@istrue != 'true') ? 'true' : 'false';}"/>
</mx:Component>

<mx:Panel id="myPanel" x="54" y="49" width="796" height="460" layout="absolute">
<mx:DataGrid id="dataGrid" x="5" y="5">
<mx:dataProvider>
<mx:XMLList xmlns="">
<node isTrue="true" name="xxxxxxxx" location="yyyyyyy"/>
<node isTrue="false" name="xxxxxxxx" location="yyyyyyy"/>
<node isTrue="true" name="xxxxxxxx" location="yyyyyyy"/>
<node isTrue="false" name="xxxxxxxx" location="yyyyyyy"/>
<node isTrue="true" name="xxxxxxxx" location="yyyyyyy"/>
</mx:XMLList>
</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn headerText="Acp" dataField="@isTrue" width="27" 
editable="false" textAlign="center">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selected="{(da...@istrue == 'true')?true:false}" 
click="{da...@istrue = (da...@istrue != 'true') ? 'true' : 'false';}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="@isTrue" width="150" headerText=" " 
editable="false" textAlign="center" itemRenderer="{itmTest}"/>
<mx:DataGridColumn dataField="@name" headerText="Name"/>
<mx:DataGridColumn dataField="@location" headerText="Location"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid x="105" y="205" dataProvider="{dataGrid.dataProvider}"/>
</mx:Panel>
</mx:Application>

Paul
--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, "Tracy 
Spratt" <tspr...@...> wrote:
>
> A drop-in check box renderer will not center in a datagrid column. That
> site explains how to fix it, without using a container. I have never seen
> one align center, regardless of column setting, unless you wrap it in a
> container.
>
>
>
> Tracy Spratt,
>
> Lariat Services, development services available
>
> _____
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On
> Behalf Of aceoohay
> Sent: Thursday, March 12, 2009 4:39 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Checkbox Itemrenderer centering mystery...
>
>
>
> That's a good resource but it doesn't answer my question.
>
> Anybody have any ideas as to what will cause an item renderer to NOT honor
> the textAlign of the dataGridColumn?
>
> Somtimes textAlign works sometimes it doesn't What causes that?
>
> Paul
>
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "Tim Hoff" <TimHoff@> wrote:
> >
> >
> > All of your answers can be found here:
> >
> > http://blogs. <http://blogs.adobe.com/aharui/item_renderers/>
> adobe.com/aharui/item_renderers/
> > <http://blogs. <http://blogs.adobe.com/aharui/item_renderers/>
> adobe.com/aharui/item_renderers/>
> >
> > -TH
> >
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "aceoohay" <pauls@> wrote:
> > >
> > > I have an itemrenderer that is a checkbox. I define textAlign="center"
> > in the datagriColumn. It doesn't center.
> > >
> > > I decided to ask folks here so I created a simple test case to post,
> > and unfortunately it works fine.
> > >
> > > I tried adding some of the things that I do in the real module, and I
> > can't get the test case to fail. The module that has the problem
> > requires a lot of other code so I can't post it as a test case.
> > >
> > > I have been told that I shouldn't use HBoxes and the like, as it adds
> > "weight" to the module.
> > >
> > > Anybody have any ideas as to what will cause an item renderer to NOT
> > honor the textAlign of the dataGridColumn?
> > >
> > > Paul
> > >
> >
>

Reply via email to