1 Reply Latest reply on Sep 30, 2009 10:40 AM by Flex harUI

    How to determine if the text is highlighted in TextInput

    NewbieToFlex

      Hi there,

       

      I am trying to determine if the text in the TextInput is highlighted.

       

      Work Flow:

      1. A Text Box is displayed with DEFAULT_TEXT

      2. User clicks on the Text Box it clears the text in the text box

      3. User type some text in the text box and click some where to loose focus

      4. User clicks the text Box again and the text inside the Textbox is selected

      5. User clicks the text Box again and the hight light is discarded and the text that was there before remains.

       

      I got the first four steps. But I can't seem to get how to do the last section.

       

      Here is my code:

       

                // clear the default text if displayed
                  if( searchTextBox.text == DEFAULT_TEXT_VALUE ) {
                      searchTextBox.text = "";
                  } // end if
                  else
                  {
                      searchTextBox.setSelection(0, searchTextBox.text.length);
                  }

       

      This is the code that I have in the handler when the click ont he textbox. How can I determine if the text is already highlighted and if it is unhilight it? Thanks.