Flex 4 component editable ComboBox no spark

I have recently started to use the version Release of Flash Builder 4, after using the beta for a while.  In the beta, the ComboBox component has a property called editable, allowing you to change the textInput component in the combobox.  If you don't want it to be editable, you can set this property is false.  With the Release version, it seems that the "editable" property isn't there anymore, and I can't figure out how to make non editable ComboBox.  Is there a way to do this?

Use s:DropDownList instead.

Peter

Tags: Flex

Similar Questions

  • Auto-Filtrer elements in an editable ComboBox

    Hello world

    I have a < MyItem > editable ComboBox. When I type in the textfield of the combobox I want to filter the items accordingly and then select an available item.

    Does anyone do this?

    I'm ChangeListeners adding to:

    .selectionModelProperty () .getValue () .selectedItemProperty)
    .editorProperty () .getValue () .textProperty)
    . valueProperty()

    without success.

    See you soon,.
    N

    It of pretty convenient, but not perfect. The trick I used here was to avoid filtering if the text in the editor of value through a selection is made. It will not automatically change the selection (the label at the bottom watching the current selection). When I tried to do, it seemed to destroy any reasonable notion of what is selected in the editor.

    The commented code is an attempt to return to the full list on a selection is made. It seems that it works, to delay treatment until after that default managers were called; That is why the Platform.runLater (...). This definitely falls into the category of the 'hack' and maybe not particularly desirable from the point of view ergonomics anyway. In addition, scrolling is kinda weird by activating this option; If you type, and then use the arrow keys for selection, it won't scroll the selected item on the first press of the arrow keys.

    A similar thing happens with the modification of the text selected in the Editor: it seems to only work if you reschedule using Platform.runLater (...). It is not clear to me why, but do not make this mess up typing a bit.

    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;
    
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.TextField;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    
    public class FilterComboBox extends Application {
    
      @Override
      public void start(Stage primaryStage) {
    
        final List items = Arrays.asList(new String[] { "Alabama",
            "Alaska", "Arizona", "Arkansas", "California", "Colorado",
            "Connecticut", "Delaware", "Georgia", "Florida", "Hawaii", "Idaho",
            "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana",
            "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota",
            "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
            "New Hampshire", "New Jersey", "New Mexico", "New York",
            "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon",
            "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
            "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington",
            "West Virginia", "Wisconsin", "Wyoming" });
        final BorderPane root = new BorderPane();
        final ComboBox comboBox = new ComboBox<>(
            FXCollections.observableArrayList(items));
        comboBox.setEditable(true);
    
        comboBox.getEditor().textProperty()
            .addListener(new ChangeListener() {
              @Override
              public void changed(ObservableValue observable,
                  String oldValue, String newValue) {
                final TextField editor = comboBox.getEditor();
                final String selected = comboBox.getSelectionModel()
                    .getSelectedItem();
                if (selected == null || !selected.equals(editor.getText())) {
                  filterItems(newValue, comboBox, items);
                  comboBox.show();
                  if (comboBox.getItems().size() == 1) {
                    final String onlyOption = comboBox.getItems().get(0);
                    final String current = editor.getText();
                    if (onlyOption.length() > current.length()) {
                      editor.setText(onlyOption);
                      // Not quite sure why this only works using
                      // Platform.runLater(...)
                      Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                          editor.selectRange(current.length(), onlyOption.length());
                        }
                      });
                    }
                  }
                }
              }
            });
    //    comboBox.setOnAction(new EventHandler() {
    //      @Override
    //      public void handle(ActionEvent event) {
    //        // Reset so all options are available:
    //        Platform.runLater(new Runnable() {
    //          @Override
    //          public void run() {
    //            String selected = comboBox.getSelectionModel().getSelectedItem();
    //            if (comboBox.getItems().size() < items.size()) {
    //              comboBox.setItems(FXCollections.observableArrayList(items));
    //              String newSelected = comboBox.getSelectionModel()
    //                  .getSelectedItem();
    //              if (newSelected == null || !newSelected.equals(selected)) {
    //                comboBox.getSelectionModel().select(selected);
    //              }
    //            }
    //          }
    //        });
    //      }
    //    });
    
        root.setTop(comboBox);
        Label label = new Label();
        label.textProperty().bind(
            comboBox.getSelectionModel().selectedItemProperty());
        root.setBottom(label);
        Scene scene = new Scene(root, 200, 400);
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      private  void filterItems(String filter, ComboBox comboBox,
          List items) {
        List filteredItems = new ArrayList<>();
        for (T item : items) {
          if (item.toString().toLowerCase().startsWith(filter.toLowerCase())) {
            filteredItems.add(item);
          }
        }
        comboBox.setItems(FXCollections.observableArrayList(filteredItems));
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    }
    
  • Editable ComboBox

    Hello

    Please help me how to change and enter the data in the combobox control...

    I have a combobox with a list of values.

    < mx:ComboBox id = "comboLov1" editable = "true" >
    < mx:dataProvider >
    < mx:Array >
    < mx:String > < / mx:String >
    < mx:String > all < / mx:String >
    Customer Name < mx:String > < / mx:String >
    Opp ID < mx:String > < / mx:String >
    End year < mx:String > < / mx:String >
    < mx:String > last updated by < / mx:String >
    < / mx:Array >
    < / mx:dataProvider >
    < / mx:ComboBox >


    for this editable combobox, the user must be able to enter data into that control and capture the enterted given in this control... And the user should also be able to choose from the lov

    What ever the data that are either user (lov entered/selected) should be able to capture and record...

    Please help me...

    Thanks in advance...

    Hi Satya,

    You can try this...


    http://www.Adobe.com/2006/mxml"layout ="absolute">

      Import mx.utils.StringUtil;
    Import mx.controls.Alert;
    Import mx.collections.ArrayCollection;
    Import mx.core.IUITextField;
    Import mx.core.UITextField;
      
    [Bindable] private var comboDataProvider:ArrayCollection = new ArrayCollection collection ([{Label: "", data: ""}, {label: given "All",: "All"}, {label: "Customer Name", data: "Customer Name"}, {label: "Opp ID", data: "ID of the Opp"}, {label: "end year", data: "Year end" ""}, {label: "last updated by", data: "last updated by"}]);
      
    private void addItemToList(event:MouseEvent):void
    {
    var inputText:String = comboLov1.text;
    If (StringUtil.Trim (inputText) == ' ')
    {
    Alert.Show ("Please enter a text to add it to the list.");
    return;
    }
    If (! checkIfItemExists (inputText))
    {
    Since it is a new LOV you can add it to the DB by sending a request to the server by using the HTTP Service or any kind of service you use
    myService.send({item:inputText});)
    comboDataProvider.addItem ({data: inputText, label: inputText});
    comboLov1.text = "";
    }
    on the other
    {
    Alert.Show ("this item already exists in the list");
    }
    }
    private void checkIfItemExists(item:String):Boolean
    {
    for each (var obj:Object in comboDataProvider)
    {
    If (String (obj. (Label) .toLowerCase () == item.toLowerCase ())
    {
    Returns true;
    }
    }
    Returns false;
    }
    ]]>

    http://localhost/yourservicedomain/service.aspx">



     
           
         
         

    Thank you

    Jean Claude

  • Based on XML dataprovider of the Combobox / Dropdownlist (spark)

    Hey guys,.

    I'm struggling a bit with a problem...

    I have a XML file which I use as a dataprovider for a combobox / dropdownlist. If I do that just in Flex with MXML (with a HTTP Service call and using its last result) it works well. However, I need to replace this XML file dynamically.

    But if I give one a section of an XML file dynamically loaded (loading is successful (for example xmlFile.Sensors) as dataprovider, I get this message:)

    Type coercion failed: cannot convert XMLList@18d8b629 to mx.collections.IList.

    Well, I came to that:

    collection: var = new XMLListCollection XMLListCollection();
    for each (var t:XML in sensorXml.Sensors)
    {
    collection.addItem (t);
    }

    .. .and by using the collection as a dataprovider. But seems a bit unnecessary... isn't there to fill the dropdownlist control with its content faster / more direct? As for example dataGrid offers you to use XML files directly as dataproviders...

    Hello

    What follows is a basic application that dynamically load your xml result in your dataprovider comboboxes.

    It may be useful

    David.

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/halo" minWidth = "955" "600" creationComplete = minHeight = "app_creationCompleteHandler (event)" ">"

    Import mx.events.FlexEvent;

    Import mx.rpc.events.FaultEvent;

    Import mx.rpc.events.ResultEvent;

    protected function myXML_resultHandler(event:ResultEvent):void

    {

    xmlMainMenu.source = event.result.children ();

    }

    protected function myXML_faultHandler(event:FaultEvent):void

    {

    Alert.Show ("could not sorry loading XML", "Error");

    }

    protected function app_creationCompleteHandler(event:FlexEvent):void

    {

    myXML.send ();

    }

    ]]>

    "result =" myXML_resultHandler (Event) "fault =" myXML_faultHandler (event) "/ >

    ======

    the xml code

    ======

  • [Flex 4] Application not including the Spark components

    I am building an application based on the module where a main application SWF load several SWF Module to be used in the application. I noticed a strange problem in loading the Modules. If I do not have a certain component (for example: spark.components.Panel) compiled manually in my SWF application, it does not compile in at all. I assumed that the entire Flex framework was automatically compiled into the main SWF (or an RSL) file by default.

    Perhaps, I put the bad things. I build the project with Ant, so my tasks look like this:

    <!-- compile the main application -->
    <target name="compile.main" depends="flex.setup">
         <mxmlc file="${flex.src.dir}/application.mxml" incremental="true"
                   output="${flex.main.file}" debug="true" link-report="${flex.linkreport.file}">
              <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
              <load-config filename="conf/project-config.xml"/>
         </mxmlc>
    </target>
    
    <!-- compile modules -->
    <target name="compile.modules" depends="flex.setup">
         <mxmlc file="${myApp.module.file}" load-externs="${flex.linkreport.file}"
                   output="${forum.module.output.file}"
                   incremental="true"
                   debug="true">
              <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
              <load-config filename="conf/project-config.xml"/>
         </mxmlc>
    </target>
    

    Two of these targets are, of course, pointing to a configuration file, I have here:

    <?xml version="1.0"?>
    <flex-config>
         <target-player>10.0.0</target-player>
         
         <compiler>
              <source-path append="true">
                   <path-element>../src</path-element>
              </source-path>
              
               <library-path append="true">
                    <path-element>../lib/as3commons-lang-1.0.0.swc</path-element>
                    <path-element>../lib/as3commons-logging-1.0.0.swc</path-element>
                    <path-element>../lib/as3commons-reflect-1.0.0.swc</path-element>
                    <path-element>../lib/as3corelib.swc</path-element>
                    <path-element>../lib/flexunit-4.0.swc</path-element>
                    <path-element>../lib/flexunit-lib-1.0.swc</path-element>
                    <path-element>../lib/flexunit-uirunner-4.0.swc</path-element>
                    <path-element>../lib/hamcrest-as3.swc</path-element>
                    <path-element>../lib/monsterdebugger-2.0.4.swc</path-element>
                    <path-element>../lib/spring-actionscript-core-0.8.swc</path-element>
                    <path-element>../lib/swfaddress-2.3.swc</path-element>
               </library-path>
         </compiler>
    </flex-config>
    

    I'm not having problems or warnings to the compilation of the code above. Is there something I'm missing here? Do I have to manually incorporate the classes/swc? I use Flex 4.0.0.7219.

    Only the classes used are linked in.  If you use the RSL will be available, they are not initialized until use

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Non editable ComboBox

    Hi I have what my combobox to be editable I did this

    Uusernamecombo = new JComboBox <>();

    Uusernamecombo.isEnabled ();

    Uusernamecombo.isEditable ();

    but my combobox is still not editable

    I use Uusernamecombo.setEditable (true);

  • Editable ComboBox bug?

    Hello

    I reproduce a ComBox behavior which I suspect to be a bug in a small example.

    When the TextField object intercepts the event, the println displays the current value = > OK

    When the ComboBox control (which is editable) intercept the println event does not display the current value = > bug?

    @Override

    {} public void start (point primaryStage)

    TextField textField = new TextField();

    ComboBox comboBox = new more;

    comboBox. setEditable (true);

    EventHandler, eventHandler (event e) =-> {}

    System.out.println ("textField text:" + textField.textProperty () .get ());

    System.out.println ("comboBox value:" + comboBox.valueProperty () .get ());

    };

    textField.addEventFilter (KeyEvent.KEY_RELEASED, eventHandler);

    comboBox.addEventFilter (KeyEvent.KEY_RELEASED, eventHandler);

    Root StackPane = new StackPane();

    VBox, vBox = new VBox (textField, comboBox);

    root.getChildren () .addAll (vBox);

    Scene = new scene (root, 300, 250);

    primaryStage.setScene (scene);

    primaryStage.show ();

    }

    Could you please confirm if this is a bug?

    Thank you

    Olivier

    In fact, it's not a bug, I found the right way to get the value:

    System.out.println ("comboBox value:" + comboBox.getEditor () .textProperty () .get ());

    Instead of

    System.out.println ("comboBox value:" + comboBox.valueProperty () .get ());

    Sorry for the inconvenience

    Olivier

  • Flex 3: property data Combobox is not recognized

    Hello

    Why is the data property Combobox is not recognized?

    I have a Simple drop-down list box, in respect of the change of the said event, a function is to be called and under this combobox.data doesn't think?

    <? XML version = "1.0" encoding = "utf-8"? >

    "< mx:Application xmlns:mx ="http://www.adobe.com/2006/mxml"layout ="absolute">"

    < mx:Array id = "myarray" >
    < mx:String > One < / mx:String >
    < mx:String > two < / mx:String >
    < mx:String > 3 < / mx:String >
    < / mx:Array >

    < mx:Script >

    <! [CDATA]
    Import mx.controls.Alert;

    public void label1_creationCompleteHandler(event:Event):void
    {

    if(MyComboBox.Data>1)
    {
    Alert.Show ('Hi');
    mycombobox.setStyle('backgroundColor','#137EC2');
    }
    }

    []] >
    < / mx:Script >
    < mx:ComboBox id = "Mazonedelistederoulante" dataProvider = "{myarray}" creationComplete = "label1_creationCompleteHandler (event)" >
    < / mx:ComboBox >
    < / mx:Application >

    Hi Kiran,

    You should not use the property data in this context. IT, real goal comes in the image when you work / are using itemRenderers and itemEditors.

    More on the if(mycombobox.data>1) of the condition will be satisfied not why because your mycombobox.data is equal to the null value and therefore the condition fails.

    data property
    data:Object[read-write]

    The data property allows you to pass a value to the component when you use it in an item converter or editor element. You use data binding to bind a field of the data property for a property of this element.

    The ComboBox control use it listData property and the data property as follows. If the ComboBox in a DataGrid control, it expects the dataField property of the column to map to a property in sets of data and selectedItem to this property. If the ComboBox control is in a list control, it is expected that the labelField of the list to map to a property in sets of data and selectedItem to this property. Otherwise, it sets selectedItem to the data itself.

    You do not set this property in MXML.

    This property can be used as the source for data binding.

    Thank you

    Jean Claude

  • How do you define an editable ComboBox selected index?

    I have a combobox that is the editable value... For some reason when I put the selectedIndex property... it does not work... The text of get set to until the first item in the drop-down list box. Does anyone have some good ideas?

    make a calllater will solve this problem if your change in dataprovider and try to set the index selected on a modifiable combox

  • Flex and XML, and Combobox.

    Hello.

    First I'll apologize for whatever it is repeated. I've had a search through the forums, but it was a long and painful process, and I couldn't really find anything useful.

    Secondly, I'm new to Flex, please stick with me if I come out with things that should be obvious.

    The question.

    I created an application base of Flex. This becomes the XML data in a PHP page that querys a MS SQL DB.

    I have the data to fill a datagrid ok, this was done to ensure that it was getting the good things in the DB.

    What I actually want is to put the data in a combobox control, but what I currently get in the CB is [object Object] for each element.

    I really don't know where I went wrong, because the code is implemented that I found on a bunch of websites.

    I really appreciate any help, advice, tips or advice on where I'm wrong with this.

    Thank you very much.

    Now, codey bit...

    Try to add this attribute in the ComboBox element:
    labelField = "trust_name."

    It should look like this:

  • Component editing markers

    Inadvertently, I turned off the markers (allowing to connect the clamps) in the Editor pane and don't know what they are called or how to reactivate them.  Help?

    Thanks for all the help.  The word I was looking for was slam a clip.  I accidentally turned off by pressing S and could not find a way to get back on.  Really appreciate your help.

  • Spark ComboBox to stop prevent by default on the home keys &amp; end events

    Greetings to the Flex community!

    Have a question about the personalization of the component s:ComboBox for my needs which are:

    If it is textInput controll can behave as original control TextInput, in which I can use the beginning and end of my keyboard to navigate in TextInput, list drop-down list. Te characters all by shift + home.

    For the moment, in the drop-down list, if I press home, it changes the selectedItem property for the first (or last, FI end of press).

    Please post suggestions. Thanks in advance.

    Listen to keydown and appeal prevents by default?

  • How do you access parent of a child component in Flex 4?

    Suppose I have a component has (as a Spark group) which generates an event, eventX.  Inside A component, I add component B (also a Spark group) who wants to be added as an event listener for eventX.  How do I enter component A component B to register for the event?

    For reference, this relationship should be similar to the MVC pattern that component B's point of view, and component A is the model and the controller.

    If I had to implemented in ActionScript, I would have no problem coding this.  However, I use flex and still trying to understand how the FLEX API.

    B could "reach" a using the parentDocument property. Or you can set a reference to A on B.

    Gordon Smith

    Adobe Flex SDK team

  • ComboBox in DataGrid ItemEditor

    Hi people,

    I have to say that I come through difficult and annoying things with Flex and there, but overall, it's really a kick-* framework and I love working with her.

    Currently, I have a situation where I have a collection of ArrayCollection of objects that I show in a DataGrid. For a certain field, I want the user to be able to edit it using a menu drop-down. I started working on it, and using an online editor I now have a drop-down list box that appears as the editor of this field by using this code:

    < mx:DataGrid dataProvider = "{customerArrayCollection}" editable = "true" >
    < mx:columns >
    < mx:DataGridColumn dataField = "customerName" editable = "false" / >
    < mx:DataGridColumn dataField = "totalSales" editable = "false" / >
    < mx:DataGridColumn dataField = "ranking" editable = "true" >
    < mx:itemEditor >
    < mx:Component >
    < mx:ComboBox / >
    < / mx:Component >
    < / mx:itemEditor >
    < / mx:DataGridColumn >
    < / mx:columns >
    < / mx:DataGrid >

    Now, I have the following questions:

    1. How can I get the combobox control to open automatically when it is shown? I assume that the user has clicked on already on the ground to change, they should not have to re - click to enlarge the combobox control. I tried to use the show event to call the open method, but the show does not fire when the combobox Editor appears. Any ideas?

    2. the values that the user can choose from this combobox are not static. What values should be displayed are based on another field in the same row. In my example above, the user should be able to define the scope of the classification a, B or C, if totalSales field is greater than 0, but if it's 0, then they should only be able to choose B or C. I do not know where to place this logic or how I can get my hands on other field values. Any suggestions for me?



    Ryan

    OK I have spent a good part of the day on it and found what I think is the answer to these two.

    First of all, on the opening of the combobox when indicated, I ended up using the combobox control focusIn event to call the open method. Eventually, he will be called whenever the Editor appears.

    Second, I realized that the data property set in the combobox control is not the field value, but the value of the entire line so you can easily watch other fields and set the dataProvider in an appropriate manner.

    The only thing that I'm stuck on now, here's how to exit the edited by programming mode. DataGrid has a private method called endEdit, but of course, because it's private I can't call him.

    Nobody has tried to do this?

    Ryan

  • Flex mobile? should I avoid it?

    Hello

    I need to develop an application for mobile... And it seems that the Flex mobile framework is a huge time saver!

    But I know adobe has fallen Apache Flex... I would not use it?

    Thank you

    Gil

    The AIR SDK and Flex SDK are different. For example, you probably have the AIR inside your flash environment but try to load something from the Flex SDK as something of a spark component would use:

    for example, Flex:

    Import mx.collections.ArrayCollection;

    It works for you? Probably not. It is only a part of a modern installation of Flex.

    Mobile Flex introduced spark optimized components that are all mobile. Adobe AIR is the runtime (VM) which gets exported in captivity and compiled to ARM. You need not have a single component Flex in your AIR for Mobile project. AIR for Mobile does not Flex.

Maybe you are looking for