Title: Message
Try these modified functions:
 
private function giveTextFocus(){
   myText.setFocus();
   doLater(this, "setTheSel");
  }
 
  private function setTheSel()
  {
   Selection.setSelection(myText.text.length, myText.text.length);
  }
 
----- Original Message -----
Sent: Friday, March 18, 2005 8:36 PM
Subject: RE: [flexcoders] Unselecting text in a field using AS

Unfortunately, that doesn't seem to be doing anything.  I have the code I'm using to try and test this below.  In the test, I am just trying to give focus to the field not changed and de-select the text within it.
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
 <mx:Script>
 <![CDATA[
  private function giveFocus(){
   combo.setFocus();
   Selection.setFocus(combo.text.length, combo.text.length);
   combo.open();
  } 
  private function giveTextFocus(){
   myText.setFocus();
   Selection.setFocus(myText.text.length, myText.text.length);
  }
 ]]>
 </mx:Script>
 
 <mx:Array id="dp">
  <mx:String>Brother</mx:String>
  <mx:String>Mom</mx:String>
  <mx:String>Dad</mx:String>
  <mx:String>Sister</mx:String>
  <mx:String>Uncle</mx:String>
 </mx:Array>
 
 <mx:Canvas>
  <mx:ComboBox editable="true" y="25" id="combo" change="giveTextFocus()" text="{myText.text}" width="200" dataProvider="{dp}" selectedIndex="0" />
  <mx:TextInput id="myText" text="{combo.text}" change="giveFocus()" width="200"/>
 </mx:Canvas>
</mx:Application>

-----Original Message-----
From: JesterXL [mailto:[EMAIL PROTECTED]
Sent: Friday, March 18, 2005 5:17 PM
To: [email protected]
Subject: Re: [flexcoders] Unselecting text in a field using AS

Selection.setFocus(yourField.text.length, yourField.text.length);
 
----- Original Message -----
Sent: Friday, March 18, 2005 8:13 PM
Subject: [flexcoders] Unselecting text in a field using AS

If I use actionScript to send focus to a textInput or editable comboBox Flex automatically selects the contents in that field.  Is there a way I can unselect the text?  I've tried resetting the value of the text property, but it doesn't unselect the contents.  What I'd like to do is unselect the contents and move the cursor to the end of the text in the field.

Thanks in advanced,
Greg


----
This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]

Littler Mendelson, P.C.
http://www.littler.com




----
This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]

Littler Mendelson, P.C.
http://www.littler.com



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to