RE: [flexcoders] setFocus() problem.
Works perfectly!! Thanks for your explanation and code. Thanks! Hari -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of JesterXL Sent: Wednesday, November 30, 2005 4:30 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] setFocus() problem. Mantra for Flash is, "When in doubt, wait a frame." You should apply that to Flex, too. Apparently, some code runs, probably via a doLater, 1 frame (or screen-repaint) after you focus on the text field. Therefore, your setSelection call actually DOES work, but is quickly changed. If you run your OWN setSelction an additional frame later, it'll re-select it. Check it, use these modified fucntions, and then type in "asdf", tab out, and then back in. function gotoend(event:Object) { trace("gotoend"); var len:Number = event.target.text.length; doLater(this, "setSelectionLater", [2, 3]); } function setSelectionLater(startIndex, endIndex) { Selection.setSelection(startIndex, endIndex); } - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Wednesday, November 30, 2005 4:13 PM Subject: RE: [flexcoders] setFocus() problem. Selection.setSelection(len,len) is not working for me. I am attaching my test mxml for your ref…. please help me…. I would like to know how to get ride off the highlight and place the curser at the end of the text? Thanks! Hari -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Monday, November 28, 2005 3:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] setFocus() problem. Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is – I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I don’t want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] setFocus() problem.
Mantra for Flash is, "When in doubt, wait a frame." You should apply that to Flex, too. Apparently, some code runs, probably via a doLater, 1 frame (or screen-repaint) after you focus on the text field. Therefore, your setSelection call actually DOES work, but is quickly changed. If you run your OWN setSelction an additional frame later, it'll re-select it. Check it, use these modified fucntions, and then type in "asdf", tab out, and then back in. function gotoend(event:Object){ trace("gotoend"); var len:Number = event.target.text.length; doLater(this, "setSelectionLater", [2, 3]);} function setSelectionLater(startIndex, endIndex){ Selection.setSelection(startIndex, endIndex);} - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Wednesday, November 30, 2005 4:13 PM Subject: RE: [flexcoders] setFocus() problem. Selection.setSelection(len,len) is not working for me. I am attaching my test mxml for your ref . please help me . I would like to know how to get ride off the highlight and place the curser at the end of the text? Thanks! Hari -Original Message-From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXLSent: Monday, November 28, 2005 3:42 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] setFocus() problem. Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I dont want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] setFocus() problem.
Selection.setSelection(len,len) is not working for me. I am attaching my test mxml for your ref…. please help me…. I would like to know how to get ride off the highlight and place the curser at the end of the text? Thanks! Hari -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Monday, November 28, 2005 3:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] setFocus() problem. Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is – I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I don’t want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. test_Events.mxml Description: test_Events.mxml
Re: [flexcoders] setFocus() problem.
It's not a bug, it's how it works. Here is the source code that makes it do it: TextField.prototype.setFocus = function() { Selection.setFocus(this); } TextField.prototype.> { if (this.tabEnabled != false) {if (this.getFocusManager().bDrawFocus) this.drawFocus(true); } } I can't find drawFocus, but I bet it does this: Selection.setSelection(0, theText.lenght);' - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:45 PM Subject: RE: [flexcoders] setFocus() problem. Thank you very much for the input. Is it a bug or what- why setFocus highlights the content of text input? Thanks! Hari -Original Message-From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXLSent: Monday, November 28, 2005 3:42 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] setFocus() problem. Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I dont want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] setFocus() problem.
Thank you very much for the input. Is it a bug or what- why setFocus highlights the content of text input? Thanks! Hari -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Monday, November 28, 2005 3:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] setFocus() problem. Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is – I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I don’t want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] setFocus() problem.
Try: this.tobdetail_ti.setFocus(); var len:Number = this.tobdetail_ti.text.length; Selection.setSelection(len, len); - Original Message - From: Doodi, Hari - BLS CTR To: flexcoders@yahoogroups.com Sent: Monday, November 28, 2005 3:33 PM Subject: [flexcoders] setFocus() problem. Hi all, I am having problems with setFocus( ) function. What I am doing is I have a textInput control with id name tobdetail_ti and in the .as file I am calling the following line of code so that if user press tab the cursor should be in this field. Focus is transferred as desired but the problem is it highlight the entire existing text. I dont want this. I want the cursor should be place at the end of the text. this.tobdetail_ti.setFocus(); Thanks! Hari -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.