You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "david bel (JIRA)" <ji...@apache.org> on 2013/08/27 17:00:59 UTC

[jira] [Created] (FLEX-33684) Only one 'custom' text entry can be enterred in a spark ComboBox

david bel created FLEX-33684:
--------------------------------

             Summary: Only one 'custom' text entry can be enterred in a spark ComboBox
                 Key: FLEX-33684
                 URL: https://issues.apache.org/jira/browse/FLEX-33684
             Project: Apache Flex
          Issue Type: Bug
          Components: Spark: ComboBox
    Affects Versions: Apache Flex 4.9.0, Apache Flex 4.10.0
         Environment: Windows 7, Intel i5, 4GB RAM
            Reporter: david bel


The spark combobox allows the user to enter a 'custom' text entry, ie an entry which doesn't match any label from the data provider.
However, the first such 'custom' item entered appears to get stuck in the control, until an item from the list is selected.

Steps to reproduce:
Compile and run the following simple application:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx">
  <s:Group>
    <s:layout><s:HorizontalLayout /></s:layout>
    <s:ComboBox id="myCombo" width="200" >
      <s:dataProvider>
        <mx:ArrayList>
          <fx:String>test1</fx:String>
          <fx:String>test2</fx:String>
          <fx:String>test3</fx:String>
        </mx:ArrayList>
      </s:dataProvider>
    </s:ComboBox>
    <s:TextInput id="myText" width="200" />
  </s:Group>
</s:WindowedApplication>

Click in the combo box and type "abc"
Tab out of the control or click in the text input to change the focus.
Click in the combo box again, and now type "xyz"
Tab out of the control again or click in the text input to change the focus.

Actual: The text input control of the combo box now contains "abc"
Expected: The text input control of the combo box should contain "xyz"

I wrote a short patch for this, but it is by no means a proper or long term solution:
	public class PatchedComboBox extends ComboBox
	{
		public function TestComboOverride()
		{
			super();
		}
		override protected function focusOutHandler(event:FocusEvent):void
		{
			applySelection();
			super.focusOutHandler(event);
		}
	}
The problem doesn't really lie with the handling of the focus out event, but rather, I believe, with a bug fix for a different though related issue (see ComboBox.as @ 895):
The setSelectedIndex method is overwritten to handle a special series of events which may cause the selection of an item to be ignored. However, this fix ignores the fact that the user may have entered a second text value.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira