5 Replies Latest reply on May 18, 2013 3:12 PM by Saber Chebka

    Disabling auto-complete on Spark ComboBox

    RandomReado Level 1

      I want to disable the auto-completing of text entered into a ComboBox, but still have it match the text against items in the DropDownList. Is there any easy way to do this?

        • 1. Re: Disabling auto-complete on Spark ComboBox
          JeffryHouser Level 4

          I think you'll have to extend the component to make this work.  I don't believe there is a property to control this behavior.

          • 2. Re: Disabling auto-complete on Spark ComboBox
            nvhdab Level 1

            Those "functionalities" are implemented by the private function processInputField() and the mx_internal function applySelection()

             

            of the ComboBox component. They are either private of mx_internal so you can't override them. I created a new AS class that extends extends DropDownListBase and implements IIMESupport, just like the Spark ComboBox and tweaked the functions, for example I commented this lines:

             

            // textInput.selectAll();

            // textInput.insertText(itemString);

             

            Hope that helps!!

            1 person found this helpful
            • 3. Re: Disabling auto-complete on Spark ComboBox
              Saber Chebka

              Simply create you new combobox class and override the findStringLoop function, it should always return -1 to prohibit the fincding of matching items (for autocomplete reasons).

              Code is the following:

               

                                  /**

                                   * Disabel the autocomplete option on Spark Combobox

                                   **/

                                  mx_internal override function findStringLoop(str:String, startIndex:int, stopIndex:int):Number

                                  {

                                       return -1;

                                  }

              • 4. Re: Disabling auto-complete on Spark ComboBox
                the_brownfoot

                The easiest solution for me was to use the existing itemMatchingFunction attribute on ComboBox and create a function like the one below retuning an empty Vector array:

                 

                protected function comboDisableMatchingFunction(comboBox:ComboBox, inputText:String):Vector.<int>

                                              {

                                                        return new Vector.<int>();

                                              }

                • 5. Re: Disabling auto-complete on Spark ComboBox
                  Saber Chebka Level 1

                  @the_brownfoot

                   

                  That is the same solution as overriding findStringLoop() method. Hopefully Flex is open source so we can invent workarounds easily