<mx:ComboBox dataProvider="{sizes.size}" creationComplete="event.target.getDropdown().cellRenderer = sizeRenderer; event.target.getDropdown().variableRowHeight=true" />

 

That worked for me.  However I did see the problems with the scrollbar and it looks like a bug in the list related to variableRowHeight.  Not sure that I really have a workaround for you right now.  Sorry!

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Philippe Maegerman
Sent: Friday, July 22, 2005 12:16 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] ComboBox cellRenderer

 

I managed to have the cellRenderer work with a List control, but can't find a way to have it working with a Combobox.

I have tried creationComplete = combo.getDropdown().cellRenderer = sizeRenderer on the combo, tried also on the Application event, but not working.

I also noticed a weird behavior, if I click the arrows or the trackBar, my last item (72) is not shown, but it does if I use keyboard up & down key or my mouse wheel ... maybe that will not happen if I have it in a Combobox.

Any help would be apreciated.

 

Here's my code:

====================================================================

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
 <mx:Model id="sizes">
  <size>6</size>
  <size>7</size>
  <size>8</size>
  <size>9</size>
  <size>10</size>
  <size>11</size>
  <size>12</size>
  <size>14</size>
  <size>16</size>
  <size>18</size>
  <size>20</size>
  <size>24</size>
  <size>28</size>
  <size>36</size>
  <size>48</size>
  <size>72</size>
 </mx:Model>
 <mx:List id="sizes_cb" width="120" height="100" dataProvider="{sizes.size}" cellRenderer="sizeRenderer" wordWrap="true" variableRowHeight="true"/>
</mx:Application>

===================================================================

cellRenderer: sizeRenderer.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.macromedia.com/2003/mxml">
 <mx:Script>
 <![CDATA[
 function setValue(str:String, item:Object, sel:Boolean){
     this.setStyle("fontSize", Number(str))
     this.text = str;
 }
 ]]>
 </mx:Script>
</mx:Label>

====================================================================

Regards,

 

Philippe Maegerman

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Philippe Maegerman
Sent: vendredi 22 juillet 2005 8:41
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] ComboBox cellRenderer

I googled some time but didn't find something close, usualy tons of AS code for datagrid.

Hopefuly there is a very simple example in the Flex book page 580 'CreditCardStatusCellRenderer', it is the mxml aproach that I was looking for.

 

Cheers,

 

Philippe Maegerman

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin
Sent: vendredi 22 juillet 2005 6:15
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] ComboBox cellRenderer

You will need to implement the normal methods of the cellRenderer (setValue) and then should use setStyle to set the font size of your label.  I would basically make your cellRenderer a Label and just call setStyle within your setValue method.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: Thursday, July 21, 2005 12:10 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ComboBox cellRenderer

 

Hi,
I'm trying to figure out how I could change the font size of combobox items.

Let's say I have this code
<mx:Model id="sizes">
  <size>6</size>
  <size>7</size>
</mx:Model>
<mx:ComboBox id="sizes_cb" dataProvider="{sizes.size}"/>

I'd like the first item to have a fontSize of 6, the second 7 etc ...

I was trying to loop into the combo.getDropdown but it doesn't seem to be a good idea.

I never used a cellRenderer before, has anyone a piece of code I could get inspired from?

do I have to implement all cellRenderers functions (setValue ...) or can I just use the setSize?

Is it possible to use an mxml file as cellRenderer?
something like
<mx:Label>
<mx:Script>function setSize(){}</mx:Script>
</mx:Label>

Sorry for the confusion

Regards,

Philippe

------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to