Set textSelectionColor of itemrenderer in my combobox

Hi all,
First of all, all apologies if this question were already discussed around. I serached and found nothing. On the web, all that I have found didn't really help.
I defined an itemRenderer for a combobox
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain" >
     <mx:Style source="styles.css" />
     <mx:Script>
          <![CDATA[
               private function check():void{
                    if(data.status=='ko'){
                         lbl.styleName='ko';
          ]]>
     </mx:Script>
     <mx:Label id="lbl"
                 text="{data.name}"
                 valueCommit="check()"
     />
</mx:VBox>
And then my combobox
<mx:ComboBox itemRenderer="listItem" labelField="name" />
I have styles the combobox component like this
ComboBox
     font-family:"HelveticaNeueLT Pro 57 Cn";
     font-size:12;
     color:#FFFFFF;
     alternatingItemColors: #555555, #383838;
     rollOverColor:#F9B41F;
     selectionColor:#2D2D2D;
     textRollOverColor:white;
     textSelectedColor:#F9B41F;
Everything is fine to the exception of the textRollOverColor & textSelectedColor properties which are ignored by the itemRenderer.
So I am looking for a way to do this.
I was advised to create a custom combobox, so I did
package custom
     import mx.controls.ComboBox;
     import mx.events.DropdownEvent;
     public class customCombobox extends ComboBox
          private var DD:ComboBox;
          public function customCombobox()
               //TODO: implement function
               super();
But I can't get how to deal with the events (rollOver/selected) so I can style the label of the itemRenderer. I am so stuck for days on that.
So thanks in advance to anyone who could help exiting this deadend
Just for info, it needs to be mx only, not spark.
Loic

The renderer is responsible for setting the text color using those styles.
Look in mx.controls.listClasses.ListItemRenderer to see how it does it.

Similar Messages

  • How to use FlashVars to set the default option on a combobox

    We are using XCelcius to display data in an XML file that is populated by another program using the Web Services approach.
    On our widget, there is a combobox that allows the user to select a specific range of data.  In Xcelcius, the value of this combobox can be defaulted using the Behavior->Default Options->Combo.
    This is good, but this also means hardcoding a particular value.  What we'd like to do is set the Default Option on the combobox via a FlashVar.
    Is this level of behavior exposed via the FlashVars so we can define the default option in our HTML file?
    Thanks for reading.

    unfortunately you cannot dynamically set the default option in 'Any' selector - so your Flash Vars approach will not work

  • How to set the prompt of a Spark Combobox programmatically

    Hi,
    here a Combobox wich use my cutom Skin to manaully set the prompt:
    <s:ComboBox id='artistNameCB' labelField="artistName"                         
              skinClass="view.music.skins.ArtistComboBoxSkin"
                                    />
    here is the reklevat part of the Skin:
    <!--- @copy spark.components.ComboBox#textInput -->
        <s:TextInput id="textInput"
               text='select'
                     left="0" right="18" top="0" bottom="0"
                     skinClass="spark.skins.spark.ComboBoxTextInputSkin"/>
    How do I set the displayed text of a combobox  programmatically ?

    ArtistComboBoxSkin(artistNameCB.skin).textInput.text = "prompt"

  • How do you set the selected item of a combobox?

    I looked around and didn't find an intrinsic method or
    function to set the selected index of a combobox. I wrote a
    function, but I thought I would see what the "best" way of doing it
    is?
    The function I wrote is;
    private function
    setComboSelectedItem(cmbBoxIn:ComboBox,strFindItem:String):void
    for (var i:int=0;i<cmbBoxIn.dataProvider.length;i++)
    if (cmbBoxIn.dataProvider(I) == strFindItem)
    cmbBoxIn.selectedIndex = i;
    break;
    The parentheses surrounding "i" above should be square
    brackets, but they do not display.
    Paul

    doing a calllater will solve this problem if your changing
    dataprovider and trying to set the selected index on an editable
    combox

  • How to set active item in a static combobox

    How can I set a specific item as the current item in a static
    combobox? Can't seem to find the right property/method for
    it.

    I know this is an old posting but the solution here dosen't
    seem to work on the fly.
    What I mean is I've created back and forward buttons to
    enable an alternative selecting method to display impoted swf's.
    I want to update the comboBox display to match the sequence
    that occurs by using the forward and back buttons.
    I have done this in Javascript but don't know how to in Flash
    8
    Thanks Rick

  • Set Spark TabBar ItemRenderer State

    I have a custom ItemRenderer for a tabBar and I need to be able to control the state of each itemRenderer on the tabBar individually. For example, if a change is made to the data in one of the tabs, I want to change the display of the tab to the "unsaved" state, so that a user has a visual cue when there are usaved edits.
    <?xml version="1.0" encoding="utf-8"?><s:ItemRenderer  xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="
    library://ns.adobe.com/flex/spark"xmlns:mx="
    library://ns.adobe.com/flex/mx"top="
    2" width="200" height="34" autoDrawBackground="false" buttonMode="true">
     <s:states>  
    <s:State name="normal"/>  
    <s:State name="selected"/>  
    <s:State name="hovered"/>  
    <s:State name="unsaved"/>
     </s:states> 
    <!-- background --> 
    <s:Rect left="1" right="1" top="1" bottom="0" radiusX="5" radiusY="5">  
    <s:fill>  
    <s:LinearGradient rotation="90">  
    <s:GradientEntry color="0xffffff"/>  
    <s:GradientEntry color="0xd8d8d8" alpha="0.85" color.selected="0xf76a6a" alpha.selected="1.0" color.hovered="0x929496" alpha.hovered="0.85"/>  
    </s:LinearGradient>  
    </s:fill>  
    </s:Rect> 
    <!-- border rectangle --> 
    <s:Line left="0" right="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line left="0" bottom="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line right="0" bottom="0" top="1">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>  
    </s:stroke>  
    </s:Line> 
    <s:Line left="0" right="0" bottom="0">  
    <s:stroke>  
    <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999" alpha.selected="0.0" color.selected="0xffffff"/>  
    </s:stroke>  
    </s:Line> 
    <s:Label left="4" right="20" fontSize="14" text="{data.LastName}, {data.FirstName}"verticalCenter="
    0"/>
     <s:Label id="closePtX" right="5" top="5" fontSize="14" fontWeight="bold" text="x"/></s:ItemRenderer>

    hi,
    With state transitions a lot of the smarts are already built in, when fading for instance the transition knows when to fade in or fade out, getting your components placed in the states you want is all that is needed.
    This is a simple example but as you can see there is virtually no code involved..
    http://gumbo.flashhub.net/cyber/  source included
    David.

  • Problem setting Index value on ComboBox

    I am running into a problem with setting the index on a
    dropdown box. I will try to give as much detail as possible. From
    what I can tell, it should be working and does, but only for one
    item. If anyone can suggest a different group to post to, let me
    know. I can not find a solution anywhere.
    I have the following code to show a combobox. The data is
    derived from a XML config file. The combobox itself works fine and
    does in fact show all of the data from the XML config file.
    <mx:HBox>
    <mx:Label text="Status" width="55"/>
    <mx:ComboBox id="uxstatus" dataProvider="{_xmlVulnStatus}"
    labelField="status"/>
    </mx:HBox>
    The part of the XML config file that is used to populate the
    combobox.
    <mainconfig>
    <vulnstatus>
    <status>Open</status>
    <status>In Progress</status>
    <status>Closed</status>
    </vulnstatus>
    </mainconfig>
    Now, when a user selects an item from a separate datagrid, on
    change I have it run the following function. The function reads in
    the data, parses it and compares the "status" value from the
    datagrid info with the "status" options in the XML config file.
    When it matches, it sets the index number for the combobox so it
    shows the right data. My problem is below the function.
    public function parseMSVulnStatus(evt:Event):void {
    var xmlMSV:XML = XML(msdetailed.selectedItem); //the host
    dataProvider item
    //trace ("MS Vuln status = "+xmlMSV.status);
    for ( var MSVi:Number=0; MSVi<_xmlVulnStatus.length();
    MSVi++ ) { //loop over the items in the dataProvider
    var sDataValueCurMSV:String =
    _xmlVulnStatus[MSVi].valueOf(); //get the current item.data value
    if ( sDataValueCurMSV == xmlMSV.status ) { //compare desired
    value to current item.data value
    mx.controls.Alert.show("match found - MS Vuln status =
    "+xmlMSV.status +" and MSVi = " +MSVi);
    msstatus.selectedIndex = MSVi; //set the seletedIndex of the
    combo box
    else {msstatus.selectedIndex = -1}
    if (msdetailed.selectedItem.falsepos=='Y')
    {msfalsepos.selected=true;}
    The problem. If the value from the datagrid is "Closed", it
    shows the index as being "2" and sets the combobox index
    appropriately and displays "Closed". The alert box is displayed
    (for testing) to show the values.
    If the value from the datagrid is either "Open" or "In
    Progress", it does show the proper index as being either 0 or 1,
    respectively and shows the alert box. However, the combobox appears
    to be set to -1. I have verified the data is set properly in the
    database (which is what populates the datagrid).
    Any thoughts on this? Based on my alert box, it appears that
    the data is seen properly and that it knows how to set the index of
    the combobox.... it's just not happening (unless it's "Closed").
    Thanks in advance.
    Chris

    you could force a selected index using something like
    mydatagrid.selectedIndex=0 or 1 try this pos i made for someone
    beacause if you want to cange the value of field based on selection
    this could be simpler by using an xml file with all the value for
    each record in one object
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1273227&CF ID=48614795&CFTOKEN=89f80916a77a7788-F5418AD3-F360-8283-2DCCA603D0E18DCF&jsessionid=48307b ef3fdf5663544a

  • How  to set a Default Value  in Combobox

    Dear All,
    I want to set a default value in a combobox  when open the form. How can I set that?
    Default value : It is one of the options of the combobox.

    Im doing it as
      If BusinessObjectInfo.FormTypeEx = "150" And BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
                oForm = SBO_Application.Forms.GetFormByTypeAndCount(BusinessObjectInfo.FormTypeEx, 1)
                Dim vepcombo As SAPbouiCOM.ComboBox
                Dim vepitem As SAPbouiCOM.Item
                vepitem = oForm.Items.Item("24")
                If vepitem.Enabled = True Then
                     vepcombo = vepitem.Specific
                    vepcombo.Select(10, SAPbouiCOM.BoSearchKey.psk_Index)
                End If
            End If

  • How to set width of a vertical scrollbar (such as in a combobox)

    I have a combox. I have successfully figured out how to set the font name and font size for each time, however as I have increased the normal very tiny size of the combobox items (now more legible), the remaining last problem is the measly 16 pixels for the scrollbar. This might be acceptable on a desktop with a precise cursor positioning system, but for mobile apps I need a way larger scrollbar thickness, perhaps 30 pixels. How does one set the scrollbar thickness for a combobox? I am willing to stick with scaled up icons from whatever is being drawn as a default, so if possible I would just like to set some style number. But can't find any documentation on this. The Apple system has a nasty fixed width scrollbar (20 pixels), and so far it seems Adobe Flash is using only 16. Great for when you are cramped but I am trying to UN-CRAMP the user interface!
    any help is greatly appreciated.  A free copy of Discus ($40 value) for whomever helps me solve this vexing problem with the least amount of effort!
    edj

    Edit the item and in the HTML Form Elements Attributes field type the following:
    style="width:120px";adjust the 120 to whatever width you like
    Shunt

  • How to set first Item in combobox

    Hi all,
    I am struggling to find out how to set the first item of the
    combobox as say "Select" because the fields i display in the
    combobox
    are optional for the user to select.
    I have in the dataprovider of combobox set to an
    arraycollection populated by a call to fill method.
    But these items should be displayed below "Select".
    Can anyone help me on this.
    Thanks,
    Lakshmi

    Hi
    Try
    yourcomboxox.prompt = "Select";
    yourcombobox.selectedIndex = -1;
    http://livedocs.adobe.com/flex/201/langref/index.html?mx/controls/ComboBox.html&mx/control s/class-list.html
    HTH
    John

  • ItemRenderer by gridCell, DataGrid questions

    Hi All,
    I am using a DataGrid with 3 columns to display data. 1st colum is just a label - non editable text, 2nd column is where I want to set/unset an itemRenderer (in this case a comboBox), 3rd column is a label - non editable or a text editable field.
    Here is my problem,  I want to be able to set/unset the item rederer by cell.  Meaning, right now you can only set it by column but I don't want all my rows to have the combo box renderer, i want it to be based on some data.  So, let say for row 0 is set to the comboBox redenrer but for row 1 it is just set to the default label renderer.  All the examples I have found you can only set the special renderer to the entire column.
    Also, for column 3 i have it define as editable (user can edit/enter text in the cell) but again you can set it to the entire column, it is posible to set it by cell.
    Many thanks in advance!

    You can try overriding createColumnItemRenderer, but some folks find it easier to have a single renderer that will show a combobox or label based on the data.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Fire itemrenderer in datagrid

    Hi All,
    I am adding a row in my datagrid dynamically using an external button but couple columns contain a combo box as itemrenderer.
    The first item (index 0) in my comboBox have option "---select---".
    How can I set this first index for both comboBox item renderers after I add the new row?
    Thanks

    Hello RootSounds,
    Good to hear from you again. Well yes, your understanding is correct.
    How do i do that?
    Bo

  • How to influence the op-direction of combobox

    Hi guys,
    All my comboboxes are opening in the direction up.
    Is there a way to influence the opening-direction of a
    combo-box, so I can set this to "down"?
    Thnx!

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    mx.controls.ComboBox (Flex 3):
    ComboBox. listData : BaseListData. When a component is used
    as a drop-in item renderer or drop-in item editor, Flex initializes
    the listData property of the
    Link:
    http://livedocs.adobe.com/flex/3/langref/mx/controls/ComboBox.html
    Tag Archive for combobox at Flex Examples:
    Setting the label color on a disabled ComboBox control in
    Flex. By peterd 0 Comments ... Specifying a custom icon function on
    a ComboBox control in Flex
    Link:
    http://blog.flexexamples.com/tag/combobox/
    Flex 3 - ComboBox control:
    If the ComboBox control is editable, and the user types into
    the control, Flex broadcasts a change event each time the text
    field of the control changes.
    Link:
    http://livedocs.adobe.com/flex/3/html/dpcontrols_5.html
    Customizing the Flex ComboBox controls text input styles at
    Flex:
    The following example shows how you can customize the
    ComboBox controls text input styles by setting the
    textInputStyleName style in Flex.
    Link:
    http://blog.flexexamples.com/2007/12/21/customizing-the-flex-combobox-controls-text-input- styles/
    ComboBox control -- Flex 2.01:
    Flex 2 Developer's Guide > Building User Interfaces for
    Flex Applications > Using Data-Driven Controls > ComboBox
    control
    Link:
    http://livedocs.adobe.com/flex/201/html/dpcontrols_062_10.html
    Displaying item tool tips in a Flex ComboBox control at Flex
    Examples:
    Text for the itemRenderer property of ComboBox. I neither got
    a tooltip nor found the contents to be wrapped around. I am
    learning Flex.
    Link:
    http://blog.flexexamples.com/2008/01/26/displaying-item-tool-tips-in-a-flex-combobox-contr ol/
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • Tree control with ComboBox

    Hi All,
    I have a need for a tree control which supports having a
    combobox. I've done extensive research on Google, but came up
    empty. If anyone has or can point me to any examples, it would be
    greatly appreciated.
    Thanks in advance!
    -jf

    Here's a follow-up to my first question.
    I found an example of a tree with checkboxes and set out to
    modify it so that it would fit my needs. I'm really stumped here,
    because it will render a checkbox or radio button fine, but I can't
    get it to render a combobox or button. I'd also like the combobox
    and button to be on the right side of the parent/child label, is
    that possible?
    Any help anyone can provide is greatly appreciated.
    Content of ComboBoxTreeRenderer:
    package util
    import mx.controls.Image;
    import mx.controls.Tree;
    import mx.controls.treeClasses.*;
    import mx.collections.*;
    import mx.controls.ComboBox;
    import mx.controls.Button;
    import mx.controls.RadioButton;
    import mx.controls.listClasses.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import mx.events.FlexEvent;
    import flash.display.DisplayObject;
    import flash.events.MouseEvent;
    import flash.xml.*;
    import mx.core.IDataRenderer;
    public class ComboBoxTreeRenderer extends TreeItemRenderer
    protected var myImage:Image;
    // set image properties
    protected var myComboBox:ComboBox;
    protected var myRadioButton:RadioButton;
    protected var myButton:Button;
    public function ComboBoxTreeRenderer ()
    super();
    mouseEnabled = false;
    override protected function createChildren():void
    super.createChildren();
    myRadioButton = new RadioButton();
    addChild(myRadioButton);
    myComboBox = new ComboBox();
    addChild(myComboBox);
    myButton = new Button();
    myButton.setStyle( "label", "Button" );
    addChild(myButton);
    override protected function
    updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    if(super.data)
    if (super.icon != null)
    myRadioButton.x = super.icon.x;
    myRadioButton.y = 2;
    super.icon.x = myRadioButton.x + myRadioButton.width + 17;
    super.label.x = super.icon.x + super.icon.width + 3;
    else
    myRadioButton.x = super.label.x;
    myRadioButton.y = 2;
    super.label.x = myRadioButton.x + myRadioButton.width + 17;
    Content of comboBoxTree_test.mxml:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init();" >
    <mx:Script>
    <![CDATA[
    import mx.collections.*;
    [Bindable]
    public var treeList:XMLList =
    <>
    <folder isBranch="true" label="Branch 1" >
    <folder isBranch="false" label="Leaf 1" />
    <folder isBranch="false" label="Leaf 2" />
    </folder>
    </>;
    [Bindable]
    public var folderCollection:XMLListCollection;
    private function init() : void
    folderCollection = new XMLListCollection(treeList);
    comboBoxTree.dataProvider = folderCollection;
    ]]>
    </mx:Script>
    <mx:Tree
    id="comboBoxTree"
    itemRenderer="util.ComboBoxTreeRenderer"
    labelField="@label"
    width="100%" height="100%" >
    </mx:Tree>
    </mx:Application>
    **************************************************************

  • How i can set the selected item of a dropDown component from java code

    Hi
    Thank you for reading my post
    How i can set the slected item of a DropDown component from backing beans java code ?
    it is binded with a database , so one field determine its display and one other field determine its value , I want to set the selected item of this combobox
    In back code i have both value and display values to use them .
    can some one give me some help ?
    Thanks ,

    See code sample 3 at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    See also, the selection components row in the table under http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    It says
    One way to preselect items is to call setSelectedValue(Object[]) or setSelectedValue(Object) from the prerender() method. You pass in the return values of the items that you want preselected. Be sure to verify that getSelected() returns null before setting the default options, or you will overwrite the user's selections on a post-back.

Maybe you are looking for