[ 
https://issues.apache.org/jira/browse/FLEX-33414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Mclean resolved FLEX-33414.
----------------------------------

       Resolution: Fixed
    Fix Version/s: Apache Flex 4.10.0

Fixed in SVN check in 1454998.
                
> Null textInput in ComboBox
> --------------------------
>
>                 Key: FLEX-33414
>                 URL: https://issues.apache.org/jira/browse/FLEX-33414
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: ComboBox
>    Affects Versions: Adobe Flex SDK Previous, Apache Flex 4.9.0
>            Reporter: Harbs
>            Assignee: Justin Mclean
>            Priority: Minor
>              Labels: easyfix
>             Fix For: Apache Flex 4.10.0
>
>
> commitProperties does a check that textInput in not bull, but at the end of 
> the function assumes it's not null:
>         // Clear the TextInput because we were programmatically set to 
> NO_SELECTION
>         // We call this after super.commitProperties because commitSelection 
> might have
>         // changed the value to NO_SELECTION
>         if (selectedIndexChanged && selectedIndex == NO_SELECTION)
>             textInput.text = "";
> I have a situation where textInput was null and caused an error there.
> I propose moving the code up into the scope of the check for textInput like 
> this:
>     override protected function commitProperties():void
>     {        
>         // Keep track of whether selectedIndex was programmatically changed
>         var selectedIndexChanged:Boolean = _proposedSelectedIndex != 
> NO_PROPOSED_SELECTION;
>         
>         // If selectedIndex was set to CUSTOM_SELECTED_ITEM, and no 
> selectedItem was specified,
>         // then don't change the selectedIndex
>         if (_proposedSelectedIndex == CUSTOM_SELECTED_ITEM && 
>             _pendingSelectedItem == undefined)
>         {
>             _proposedSelectedIndex = NO_PROPOSED_SELECTION;
>         }
>         
>         super.commitProperties();
>         
>         if (textInput)
>         {
>             if (maxCharsChanged)
>             {
>                 textInput.maxChars = _maxChars;
>                 maxCharsChanged = false;
>             }
>             
>             if (promptChanged)
>             {
>                 textInput.prompt = _prompt;
>                 promptChanged = false;
>             }
>             
>             if (restrictChanged)
>             {
>                 textInput.restrict = _restrict;
>                 restrictChanged = false;
>             }
>             
>             if (typicalItemChanged)
>             {
>                 if (typicalItem != null)
>                 {
>                     var itemString:String = 
> LabelUtil.itemToLabel(typicalItem, labelField, labelFunction);
>                     textInput.widthInChars = itemString.length;
>                 }
>                 else
>                 {
>                     // Just set it back to the default value
>                     textInput.widthInChars = 10; 
>                 }
>                 
>                 typicalItemChanged = false;
>             }
>             // Clear the TextInput because we were programmatically set to 
> NO_SELECTION
>             // We call this after super.commitProperties because 
> commitSelection might have
>             // changed the value to NO_SELECTION
>             if (selectedIndexChanged && selectedIndex == NO_SELECTION)
>                 textInput.text = "";
>         }
>         
>     }    

--
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

Reply via email to