1 Reply Latest reply on Jul 29, 2010 10:43 AM by jhooon_

    Problems with buttons

    jhooon_

      Hi.

       

      I am creating an datagrid that use one button in the last column and in each line. Well, the button has a styleName that can be different of others buttons it will be depending on the data of button.

       

      I am using the dataChange for verifying the kind of data button and so define the styleName of the button. The styleName define a image of the button.

      But the image when appears in datagrid is too large! I have tried difine the width and hight properties of the button but it does not function. Take a look in my code: ( I am copying part of the code)

       

       

       

       

      <mx:DataGridColumn width="100"

           textAlign="center"  >

       

       

      <mx:itemRenderer>

             <mx:Component>

                   <mx:Button click="{onClick()}" dataChange="{onDataChange(event);}"  buttonMode="true">

       

       

                          private function onDataChange(event:FlexEvent):void{

                           if(data[6] == null )

                           {

                            this.styleName = "btSensorLogAlertas";

                            this.width=5;

                            this.height=5;

                          }

                         else

                          {

                           this.styleName = "btSensorGraficos";

                           this.width=5;

                            this.height=5;

                          }

                         }

       

      see how it looks:

       

      Sem título.jpg

      I need the imagem button to be smaller.

       

       

      I have tried put the width/heigth in tag <mx:Button> but without success.

      I also tried put a HBOX like:

       

       

       

      <mx:itemRenderer>

                               <mx:Component>

                               

                                <mx:HBox >

                              

                                     <mx:Button ..... >

       

            .

            .

            .

            .

       

      </mx:itemRenderer>

                               </mx:Component>

                               

                                </mx:HBox >

       

       

      In this case appears only a green box. The styleName doest work.

       

      see how it looks:

       

       

           Sem título.jpg

      Someone has a ideia for my problem?

      Thanks