Flex expands ComboBox

I created a class CustomCombo.asthat extends ComboBox. It happens that the drop-down field is CustomCombodisplayed as editable. I do not want this, and I cannot find the properties to set editableto false.

I also tried setting the combobox control to a textInput.editablevalue false, but to no avail.

Any help would be greatly appreciated.

CustomCombo.as

package custom {

    import spark.components.ComboBox;

    public class CustomCombo extends ComboBox {

        public function CustomCombo() {
            super();
//          this.editable = false; //<-- THIS DOESNT WORK   ***Access of possibly undefined property editable through a reference with static type custom:CustomCombo
//          this.textInput.editable = false; //<-- THIS DOESNT WORK   ***Cannot access a property or method of a null object reference
        }
    }
}
+3
source share
2 answers

API Flex 4 , DropDownList. , , , editable ComboBox Flex 4, .

DropDownList, .

+2

, , mx. editable, , mx. In spark, ComboBox extends DropDownListBase .

ComboBox - DropDownListBase. DropDownListBase, ComboBox, .

, ComboBox TextInput Label DropDownList. , .

, DropDownList . ComboBox , . , , , .

ComboBox , . , . .

DropDownList .

TextInput , . mx (Flex-3) creationComplete; , .

: , , ( DropDownBox). partAdded.

override protected function partAdded(partName:String, instance:Object):void
{
    super.partAdded(partName, instance);
    if (instance == textInput)
    {
        textInput.editable = false;
    }
}

: . ComboBox.as ,

API editable selectable

, DropDownList !


, mx ComboBox.

, editable - false.

false .

public function CustomCombo() {
  super();
  this.editable = false;
}
+1

Source: https://habr.com/ru/post/1752040/


All Articles