[flexcoders] Caret positioning problem

2005-08-10 Thread Mika Kiljunen










Hi,

Im trying to set the caret to the end of the
textfield. I have a keyUp event handler that adds the dot . automatically
for the text entered. The problem is that when the dot is added by actionscript
the caret stays behind the added dot while typing, so the dot gets misplaced
and the typing comes out wrong. How can I position the caret AFTER the
autoinserted dot? Ive tried to fool around with the Selection class
functions but none of it seems to help.



Here is an example of the handler Id like to use:



function onKeyUp( event )

 {

 if( MyTextField.text.length == 2 )

 { 

 MyTextField.text = MyTextField.text
+ .;

 // HOW TO POSITION THE CARET HERE SO
THAT IT COMES OUT LIKE THIS ON TEXTFIELD: myenteredtext.CARET_BLINKING_HERE???

 }

 }



-Mika









--
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] Caret positioning problem

2005-08-10 Thread Allen Manning










Mika,



Have you looked at:



Selection.setSelection(stringLength,stringLength)





HTH,

Allen

www.prismix.com/











From:
flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: 10 August 2005 13:25
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caret
positioning problem





Hi,

Im trying to set the caret to the end of the
textfield. I have a keyUp event handler that adds the dot .
automatically for the text entered. The problem is that when the dot is added
by actionscript the caret stays behind the added dot while typing, so the dot
gets misplaced and the typing comes out wrong. How can I position the caret
AFTER the autoinserted dot? Ive tried to fool around with the Selection
class functions but none of it seems to help.



Here is an example of the handler Id like to
use:



function onKeyUp( event )


{


if( MyTextField.text.length == 2 )


{



MyTextField.text = MyTextField.text + .;


// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD:
myenteredtext.CARET_BLINKING_HERE???


}


}



-Mika









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

Computer software testing
  
  
Macromedia flex
  
  
Development
  
  


Software developer
  

   
  







  
  
  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] Caret positioning problem

2005-08-10 Thread Philippe Maegerman





var fm = 
getFocusManager();fm.setFocus(MyTextField);Selection.setSelection(0,MyTextField.text.length)
Philippe 
Maegerman


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Allen 
ManningSent: mercredi 10 août 2005 14:32To: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem


Mika,

Have you looked 
at:

Selection.setSelection(stringLength,stringLength)


HTH,
Allen
www.prismix.com/





From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika KiljunenSent: 10 August 2005 13:25To: flexcoders@yahoogroups.comSubject: [flexcoders] Caret positioning 
problem

Hi,
I'm trying to set the caret to the 
end of the textfield. I have a keyUp event handler that adds the dot "." 
automatically for the text entered. The problem is that when the dot is added by 
actionscript the caret stays behind the added dot while typing, so the dot gets 
misplaced and the typing comes out wrong. How can I position the caret AFTER the 
autoinserted dot? I've tried to fool around with the Selection class functions 
but none of it seems to help..

Here is an example of the handler 
I'd like to use:

function onKeyUp( event 
)
 
{
 
if( MyTextField.text.length == 2 )
 
{ 

 
MyTextField.text = MyTextField.text + ".";
 
// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD: 
"myenteredtext.CARET_BLINKING_HERE???
 
}
 
}

-Mika






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

Computer software testing
  
  
Macromedia flex
  
  
Development
  
  


Software developer
  

   
  







  
  
  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.



  






--**STATEMENT OF CONFIDENTIALITY** 
This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.
We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.--


RE: [flexcoders] Caret positioning problem

2005-08-10 Thread Mika Kiljunen










Thanks, but it wont help. If I type
in 23 my handler adds a dot to it and the text becomes 23.


Your code sets the 23
selected and caret is there (not after the added dot as it should be), the
thing is that it should show 23. and caret after that, and no selection.



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 15:35
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





var
fm = getFocusManager();
fm.setFocus(MyTextField);
Selection.setSelection(0,MyTextField.text.length)



Philippe
Maegerman











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Allen Manning
Sent: mercredi 10 août 2005 14:32
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem

Mika,



Have you looked at:



Selection.setSelection(stringLength,stringLength)





HTH,

Allen

www.prismix.com/











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: 10 August 2005 13:25
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caret
positioning problem





Hi,

I'm trying to set the caret to the end of the textfield. I
have a keyUp event handler that adds the dot . automatically for
the text entered. The problem is that when the dot is added by actionscript the
caret stays behind the added dot while typing, so the dot gets misplaced and the
typing comes out wrong. How can I position the caret AFTER the autoinserted
dot? I've tried to fool around with the Selection class functions but none of
it seems to help..



Here is an example of the handler I'd like to use:



function onKeyUp( event )


{


if( MyTextField.text.length == 2 )


{



MyTextField.text = MyTextField.text + .;


// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD:
myenteredtext.CARET_BLINKING_HERE???


}


}



-Mika











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



  








--**STATEMENT OF CONFIDENTIALITY** 
This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.
We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.--



RE: [flexcoders] Caret positioning problem

2005-08-10 Thread Philippe Maegerman





MyTextField.text.length+1 
maybe ;)

Philippe 
Maegerman


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Mika 
KiljunenSent: mercredi 10 août 2005 14:47To: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem


Thanks, but it won’t 
help. If I type in “23” my handler adds a dot to it and the text becomes “23.” 

Your code sets the “23” 
selected and caret is there (not after the added dot as it should be), the thing 
is that it should show 23. and caret after that, and no 
selection.

-Mika





From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Philippe 
MaegermanSent: 10. elokuuta 
2005 15:35To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem

var fm = 
getFocusManager();fm.setFocus(MyTextField);Selection.setSelection(0,MyTextField.text.length)

Philippe 
Maegerman




From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Allen 
ManningSent: mercredi 10 août 
2005 14:32To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem
Mika,

Have you looked 
at:

Selection.setSelection(stringLength,stringLength)


HTH,
Allen
www.prismix.com/





From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Mika 
KiljunenSent: 10 August 2005 
13:25To: flexcoders@yahoogroups.comSubject: [flexcoders] Caret positioning 
problem

Hi,
I'm trying to set the caret to the 
end of the textfield. I have a keyUp event handler that adds the dot "." 
automatically for the text entered. The problem is that when the dot is added by 
actionscript the caret stays behind the added dot while typing, so the dot gets 
misplaced and the typing comes out wrong. How can I position the caret AFTER the 
autoinserted dot? I've tried to fool around with the Selection class functions 
but none of it seems to help..

Here is an example of the handler 
I'd like to use:

function onKeyUp( event 
)
 
{
 
if( MyTextField.text.length == 2 )
 
{ 

 
MyTextField.text = MyTextField.text + ".";
 
// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD: 
"myenteredtext.CARET_BLINKING_HERE???
 
}
 
}

-Mika


--**STATEMENT 
OF CONFIDENTIALITY** 
This e-mail and any attached files are confidential 
and intended solely for the use of the individual to whom it is addressed. If 
you have received this email in error please send it back to the person that 
sent it to you. Any views or opinions presented are solely those of author and 
do not necessarily represent those the Emakina Company. Unauthorized 
publication, use, dissemination, forwarding, printing or copying of this email 
and its associated attachments is strictly prohibited.
We also inform you that we have checked that this 
message does not contain any virus but we decline any responsability in case of 
any damage caused by an a non detected 
virus.--





--
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] Caret positioning problem

2005-08-10 Thread Mika Kiljunen










You wishbut  no, does not work (already
tried it) L



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 16:16
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





MyTextField.text.length+1 maybe ;)



Philippe
Maegerman









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: mercredi 10 août 2005 14:47
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem



Thanks, but it wont help. If I type
in 23 my handler adds a dot to it and the text becomes
23. 

Your code sets the 23
selected and caret is there (not after the added dot as it should be), the
thing is that it should show 23. and caret after that, and no selection.



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 15:35
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





var
fm = getFocusManager();
fm.setFocus(MyTextField);
Selection.setSelection(0,MyTextField.text.length)



Philippe
Maegerman











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Allen Manning
Sent: mercredi 10 août 2005 14:32
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem

Mika,



Have you looked at:



Selection.setSelection(stringLength,stringLength)





HTH,

Allen

www.prismix.com/











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: 10 August 2005 13:25
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caret
positioning problem





Hi,

I'm trying to set the caret to the end of the textfield. I
have a keyUp event handler that adds the dot . automatically for
the text entered. The problem is that when the dot is added by actionscript the
caret stays behind the added dot while typing, so the dot gets misplaced and the
typing comes out wrong. How can I position the caret AFTER the autoinserted
dot? I've tried to fool around with the Selection class functions but none of
it seems to help..



Here is an example of the handler I'd like to use:



function onKeyUp( event )


{


if( MyTextField.text.length == 2 )


{



MyTextField.text = MyTextField.text + .;


// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD:
myenteredtext.CARET_BLINKING_HERE???


}


}



-Mika









--
**STATEMENT OF CONFIDENTIALITY** 

This e-mail and any attached files are confidential and intended solely
for the use of the individual to whom it is addressed. If you have received
this email in error please send it back to the person that sent it to you. Any
views or opinions presented are solely those of author and do not necessarily
represent those the Emakina Company. Unauthorized publication, use,
dissemination, forwarding, printing or copying of this email and its associated
attachments is strictly prohibited.

We also inform you that we have checked that this message does not
contain any virus but we decline any responsability in case of any damage
caused by an a non detected virus.
--









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

Computer software testing
  
  
Macromedia flex
  
  
Development
  
  


Software developer
  

   
  







  
  
  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] Caret positioning problem

2005-08-10 Thread Philippe Maegerman





Don't ask me how I found it, I tried all kind of things 
likesetInterval, doLateretc ... 

MyTextField.text = 
MyTextField.text + ".";MyTextField.redraw();var fm = 
getFocusManager();fm.setFocus(MyTextField);Selection.setSelection(0,MyTextField.text.length)

Enjoy++

Philippe 
Maegerman
Webdeveloper
+32 2 400 40 
39
+32 472 35 28 
10
Avoir des rêves, 
c'est continuer d'exister... 



From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Mika 
KiljunenSent: mercredi 10 août 2005 15:27To: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem


You wish…but no, 
does not work (already tried it) L

-Mika





From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Philippe 
MaegermanSent: 10. elokuuta 
2005 16:16To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem

MyTextField.text.length+1 
maybe ;)

Philippe 
Maegerman




From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Mika 
KiljunenSent: mercredi 10 août 
2005 14:47To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem
Thanks, but it won’t 
help. If I type in “23” my handler adds a dot to it and the text becomes “23.” 

Your code sets the “23” 
selected and caret is there (not after the added dot as it should be), the thing 
is that it should show 23. and caret after that, and no 
selection.

-Mika





From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Philippe 
MaegermanSent: 10. elokuuta 
2005 15:35To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem

var fm = 
getFocusManager();fm.setFocus(MyTextField);Selection.setSelection(0,MyTextField.text.length)

Philippe 
Maegerman




From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Allen 
ManningSent: mercredi 10 août 
2005 14:32To: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Caret positioning 
problem
Mika,

Have you looked 
at:

Selection.setSelection(stringLength,stringLength)


HTH,
Allen
www.prismix.com/





From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] 
On Behalf Of Mika 
KiljunenSent: 10 August 2005 
13:25To: flexcoders@yahoogroups.comSubject: [flexcoders] Caret positioning 
problem

Hi,
I'm trying to set the caret to the 
end of the textfield. I have a keyUp event handler that adds the dot "." 
automatically for the text entered. The problem is that when the dot is added by 
actionscript the caret stays behind the added dot while typing, so the dot gets 
misplaced and the typing comes out wrong. How can I position the caret AFTER the 
autoinserted dot? I've tried to fool around with the Selection class functions 
but none of it seems to help..

Here is an example of the handler 
I'd like to use:

function onKeyUp( event 
)
 
{
 
if( MyTextField.text.length == 2 )
 
{ 

 
MyTextField.text = MyTextField.text + ".";
 
// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD: 
"myenteredtext.CARET_BLINKING_HERE???
 
}
 
}

-Mika


--**STATEMENT 
OF CONFIDENTIALITY** 
This e-mail and any attached files 
are confidential and intended solely for the use of the individual to whom it is 
addressed. If you have received this email in error please send it back to the 
person that sent it to you. Any views or opinions presented are solely those of 
author and do not necessarily represent those the Emakina Company. Unauthorized 
publication, use, dissemination, forwarding, printing or copying of this email 
and its associated attachments is strictly prohibited.
We also inform you that we have 
checked that this message does not contain any virus but we decline any 
responsability in case of any damage caused by an a non detected 
virus.--






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

Computer software testing
  
  
Macromedia flex
  
  
Development
  
  


Software developer
  

   
  







  
  
  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] Caret positioning problem

2005-08-10 Thread Niklas Richardson
Yeah, I just found that if you split the two commands into separate
functions, and associate them with the click event on two bottons. 
Then pressing the first button (to add the dot) and then pressing the
second button (to select the end of the string), then it works.

Nice find on the redraw().  What made you think of that?

If you set the first number in setSelection() then it will just give
you a single caret rather than selection the whole text.  Like Allen
suggested earlier.  This is the code I used to get it working (using
your redraw() trick Philippe).  You don't need to use the FocusManager
then either (okay, so you only save one line).

myText.text = myText.text + '.';
myText.redraw();
Selection.setFocus(myText);
Selection.setSelection(myText.text.length, myText.text.length);

Cheers

Niklas



On 10/08/05, Philippe Maegerman [EMAIL PROTECTED] wrote:
  
 Don't ask me how I found it, I tried all kind of things like setInterval,
 doLater etc ... 
   
 MyTextField.text = MyTextField.text + .;
 MyTextField.redraw();
 var fm = getFocusManager();
 fm.setFocus(MyTextField);
 Selection.setSelection(0,MyTextField.text.length) 
   
 Enjoy++ 
   
 Philippe Maegerman 
 Web developer 
 +32 2 400 40 39 
 +32 472 35 28 10 
 Avoir des rêves, c'est continuer d'exister... 
  
  
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Mika Kiljunen
 Sent: mercredi 10 août 2005 15:27
 
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
  
  
  
 
 You wish…but  no, does not work (already tried it) L 
 
   
 
 -Mika 
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Philippe Maegerman
 Sent: 10. elokuuta 2005 16:16
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem 
 
   
 
 MyTextField.text.length+1 maybe ;) 
 
   
 
 Philippe Maegerman 
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Mika Kiljunen
 Sent: mercredi 10 août 2005 14:47
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem 
 
 Thanks, but it won't help. If I type in 23 my handler adds a dot to it and
 the text becomes 23. 
 
 Your code sets the 23 selected and caret is there (not after the added dot
 as it should be), the thing is that it should show 23. and caret after that,
 and no selection. 
 
   
 
 -Mika 
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Philippe Maegerman
 Sent: 10. elokuuta 2005 15:35
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem 
 
   
 
 var fm = getFocusManager();
 fm.setFocus(MyTextField);
 Selection.setSelection(0,MyTextField.text.length) 
  
 
 Philippe Maegerman 
 
   
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Allen Manning
 Sent: mercredi 10 août 2005 14:32
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem 
 
 Mika, 
 
   
 
 Have you looked at: 
 
   
 
 Selection.setSelection(stringLength,stringLength) 
 
   
 
   
 
 HTH, 
 
 Allen 
 
 www.prismix.com/ 
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Mika Kiljunen
 Sent: 10 August 2005 13:25
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Caret positioning problem 
 
   
 
 Hi, 
 
 I'm trying to set the caret to the end of the textfield. I have a keyUp
 event handler that adds the dot . automatically for the text entered. The
 problem is that when the dot is added by actionscript the caret stays behind
 the added dot while typing, so the dot gets misplaced and the typing comes
 out wrong. How can I position the caret AFTER the autoinserted dot? I've
 tried to fool around with the Selection class functions but none of it seems
 to help.. 
 
   
 
 Here is an example of the handler I'd like to use: 
 
   
 
 function onKeyUp( event ) 
 
 { 
 
 if( MyTextField.text.length == 2 ) 
 
 {   
 
 MyTextField.text = MyTextField.text + .; 
 
 // HOW TO POSITION THE CARET HERE SO THAT IT COMES
 OUT LIKE THIS ON TEXTFIELD:
 myenteredtext.CARET_BLINKING_HERE??? 
 
 } 
 
 } 
 
   
 
 -Mika 
 
   
 
 
 
  
 
 --
 **STATEMENT OF CONFIDENTIALITY** 
 
 This e-mail and any attached files are confidential and intended solely for
 the use of the individual to whom it is addressed. If you have received this
 email in error please send it back to the person that sent it to you. Any
 views or opinions presented are solely those of author and do not
 necessarily represent those the Emakina

RE: [flexcoders] Caret positioning problem

2005-08-10 Thread Mika Kiljunen










Thanks a lot man, finally it works!

I thought Id try that also but didnt
get to that one yet. I was just about to send a fictive KEY.DOWN event cause it
sends the carret to the end of the text (at least it should) But this is
far better. 



Thank you Philippe! 



Give respect for Philippe folks, cause hes
the man. J



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 16:42
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





Don't ask me how
I found it, I tried all kind of things likesetInterval, doLateretc
... 









MyTextField.text
= MyTextField.text + .;
MyTextField.redraw();
var fm = getFocusManager();
fm.setFocus(MyTextField);
Selection.setSelection(0,MyTextField.text.length)











Enjoy++









Philippe
Maegerman

Webdeveloper

+32 2 400 40 39

+32 472 35 28 10

Avoir des rêves, c'est
continuer d'exister... 















From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: mercredi 10 août 2005 15:27
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem

You wishbut no, does not work
(already tried it) L



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 16:16
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





MyTextField.text.length+1 maybe ;)



Philippe
Maegerman









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: mercredi 10 août 2005 14:47
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem



Thanks, but it wont help. If I type
in 23 my handler adds a dot to it and the text becomes
23. 

Your code sets the 23
selected and caret is there (not after the added dot as it should be), the
thing is that it should show 23. and caret after that, and no selection.



-Mika











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: 10. elokuuta 2005 15:35
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem





var
fm = getFocusManager();
fm.setFocus(MyTextField);
Selection.setSelection(0,MyTextField.text.length)



Philippe
Maegerman











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Allen Manning
Sent: mercredi 10 août 2005 14:32
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Caret
positioning problem

Mika,



Have you looked at:



Selection.setSelection(stringLength,stringLength)





HTH,

Allen

www.prismix.com/











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: 10 August 2005 13:25
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caret
positioning problem





Hi,

I'm trying to set the caret to the end of the textfield. I
have a keyUp event handler that adds the dot . automatically for
the text entered. The problem is that when the dot is added by actionscript the
caret stays behind the added dot while typing, so the dot gets misplaced and
the typing comes out wrong. How can I position the caret AFTER the autoinserted
dot? I've tried to fool around with the Selection class functions but none of
it seems to help..



Here is an example of the handler I'd like to use:



function onKeyUp( event )


{


if( MyTextField.text.length == 2 )


{



MyTextField.text = MyTextField.text + .;


// HOW TO POSITION THE CARET HERE SO THAT IT COMES OUT LIKE THIS ON TEXTFIELD:
myenteredtext.CARET_BLINKING_HERE???


}


}



-Mika





--
**STATEMENT OF CONFIDENTIALITY** 

This e-mail and any attached files are confidential and intended solely
for the use of the individual to whom it is addressed. If you have received
this email in error please send it back to the person that sent it to you. Any views
or opinions presented are solely those of author and do not necessarily
represent those the Emakina Company. Unauthorized publication, use,
dissemination, forwarding, printing or copying of this email and its associated
attachments is strictly prohibited.

We also inform you that we have checked that this message does not
contain any virus but we decline any responsability in case of any damage
caused by an a non detected virus.
--











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

Computer software testing
  
  
Macromedia flex
  
  
Development

RE: [flexcoders] Caret positioning problem

2005-08-10 Thread Philippe Maegerman
Well I thought it was a question of timing so I tried doLater() and 
setInterval(), and it wasn't working.  
When tracing the text length in the second function called by doLater, it was 
showing the right value, gr!! 
Then I tried with static text 23. in the field and setSelection(0,3) and that 
was working, so I guessed it was just the component not redrawing fast enough, 
then I tried redraw(), and voil
redraw() has saved me a few times already in datagrid and others, sometimes 
invalidate() do the job too.

Philippe Maegerman

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Niklas 
Richardson
Sent: mercredi 10 août 2005 15:49
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Caret positioning problem

Yeah, I just found that if you split the two commands into separate functions, 
and associate them with the click event on two bottons. 
Then pressing the first button (to add the dot) and then pressing the second 
button (to select the end of the string), then it works.

Nice find on the redraw().  What made you think of that?

If you set the first number in setSelection() then it will just give you a 
single caret rather than selection the whole text.  Like Allen suggested 
earlier.  This is the code I used to get it working (using your redraw() trick 
Philippe).  You don't need to use the FocusManager then either (okay, so you 
only save one line).

myText.text = myText.text + '.';
myText.redraw();
Selection.setFocus(myText);
Selection.setSelection(myText.text.length, myText.text.length);

Cheers

Niklas



On 10/08/05, Philippe Maegerman [EMAIL PROTECTED] wrote:
  
 Don't ask me how I found it, I tried all kind of things like 
 setInterval, doLater etc ...
   
 MyTextField.text = MyTextField.text + .; MyTextField.redraw(); var 
 fm = getFocusManager(); fm.setFocus(MyTextField);
 Selection.setSelection(0,MyTextField.text.length)
   
 Enjoy++ 
   
 Philippe Maegerman
 Web developer
 +32 2 400 40 39
 +32 472 35 28 10
 Avoir des rêves, c'est continuer d'exister... 
  
  
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Mika Kiljunen
 Sent: mercredi 10 août 2005 15:27
 
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
  
  
  
 
 You wish...but  no, does not work (already tried it) L
 
   
 
 -Mika
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Philippe Maegerman
 Sent: 10. elokuuta 2005 16:16
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
   
 
 MyTextField.text.length+1 maybe ;)
 
   
 
 Philippe Maegerman
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Mika Kiljunen
 Sent: mercredi 10 août 2005 14:47
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
 Thanks, but it won't help. If I type in 23 my handler adds a dot to 
 it and the text becomes 23.
 
 Your code sets the 23 selected and caret is there (not after the 
 added dot as it should be), the thing is that it should show 23. and 
 caret after that, and no selection.
 
   
 
 -Mika
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Philippe Maegerman
 Sent: 10. elokuuta 2005 15:35
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
   
 
 var fm = getFocusManager();
 fm.setFocus(MyTextField);
 Selection.setSelection(0,MyTextField.text.length)
  
 
 Philippe Maegerman
 
   
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Allen Manning
 Sent: mercredi 10 août 2005 14:32
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Caret positioning problem
 
 Mika,
 
   
 
 Have you looked at: 
 
   
 
 Selection.setSelection(stringLength,stringLength)
 
   
 
   
 
 HTH,
 
 Allen
 
 www.prismix.com/
 
   
  
  
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 On Behalf Of Mika Kiljunen
 Sent: 10 August 2005 13:25
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Caret positioning problem
 
   
 
 Hi,
 
 I'm trying to set the caret to the end of the textfield. I have a 
 keyUp event handler that adds the dot . automatically for the text 
 entered. The problem is that when the dot is added by actionscript the 
 caret stays behind the added dot while typing, so the dot gets 
 misplaced and the typing comes out wrong. How can I position the caret 
 AFTER the autoinserted dot? I've tried to fool around with the 
 Selection class functions but none of it seems to help..
 
   
 
 Here is an example of the handler I'd like to use: 
 
   
 
 function onKeyUp( event )
 
 {
 
 if( MyTextField.text.length == 2

Re: [flexcoders] Caret positioning problem

2005-08-10 Thread Niklas Richardson
Mika,

I've just seen some wacky behaviour with using that function on the
keyUp.  If you type too quickly it skips adding the period.  Also, if
you try to delete (backspace) after typing, you get into a loop or it
recreating the period.  However, if you hit backspace really quickly
you can get past it! :)

Something to watch out for!

Cheers

Niklas


On 10/08/05, Niklas Richardson [EMAIL PROTECTED] wrote:
 Yeah, I just found that if you split the two commands into separate
 functions, and associate them with the click event on two bottons.
 Then pressing the first button (to add the dot) and then pressing the
 second button (to select the end of the string), then it works.
 
 Nice find on the redraw().  What made you think of that?
 
 If you set the first number in setSelection() then it will just give
 you a single caret rather than selection the whole text.  Like Allen
 suggested earlier.  This is the code I used to get it working (using
 your redraw() trick Philippe).  You don't need to use the FocusManager
 then either (okay, so you only save one line).
 
 myText.text = myText.text + '.';
 myText.redraw();
 Selection.setFocus(myText);
 Selection.setSelection(myText.text.length, myText.text.length);
 
 Cheers
 
 Niklas
 
 
 
 On 10/08/05, Philippe Maegerman [EMAIL PROTECTED] wrote:
 
  Don't ask me how I found it, I tried all kind of things like setInterval,
  doLater etc ...
 
  MyTextField.text = MyTextField.text + .;
  MyTextField.redraw();
  var fm = getFocusManager();
  fm.setFocus(MyTextField);
  Selection.setSelection(0,MyTextField.text.length)
 
  Enjoy++
 
  Philippe Maegerman
  Web developer
  +32 2 400 40 39
  +32 472 35 28 10
  Avoir des rêves, c'est continuer d'exister...
 
 
   
   From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: mercredi 10 août 2005 15:27
 
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
 
 
  You wish…but  no, does not work (already tried it) L
 
 
 
  -Mika
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Philippe Maegerman
  Sent: 10. elokuuta 2005 16:16
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
  MyTextField.text.length+1 maybe ;)
 
 
 
  Philippe Maegerman
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: mercredi 10 août 2005 14:47
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
  Thanks, but it won't help. If I type in 23 my handler adds a dot to it and
  the text becomes 23.
 
  Your code sets the 23 selected and caret is there (not after the added dot
  as it should be), the thing is that it should show 23. and caret after that,
  and no selection.
 
 
 
  -Mika
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Philippe Maegerman
  Sent: 10. elokuuta 2005 15:35
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
  var fm = getFocusManager();
  fm.setFocus(MyTextField);
  Selection.setSelection(0,MyTextField.text.length)
 
 
  Philippe Maegerman
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Allen Manning
  Sent: mercredi 10 août 2005 14:32
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
  Mika,
 
 
 
  Have you looked at:
 
 
 
  Selection.setSelection(stringLength,stringLength)
 
 
 
 
 
  HTH,
 
  Allen
 
  www.prismix.com/
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: 10 August 2005 13:25
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Caret positioning problem
 
 
 
  Hi,
 
  I'm trying to set the caret to the end of the textfield. I have a keyUp
  event handler that adds the dot . automatically for the text entered. The
  problem is that when the dot is added by actionscript the caret stays behind
  the added dot while typing, so the dot gets misplaced and the typing comes
  out wrong. How can I position the caret AFTER the autoinserted dot? I've
  tried to fool around with the Selection class functions but none of it seems
  to help..
 
 
 
  Here is an example of the handler I'd like to use:
 
 
 
  function onKeyUp( event )
 
  {
 
  if( MyTextField.text.length == 2 )
 
  {
 
  MyTextField.text = MyTextField.text + .;
 
  // HOW TO POSITION THE CARET HERE SO THAT IT COMES
  OUT LIKE THIS ON TEXTFIELD:
  myenteredtext.CARET_BLINKING_HERE???
 
  }
 
  }
 
 
 
  -Mika

RE: [flexcoders] Caret positioning problem

2005-08-10 Thread Mika Kiljunen
Yep, I know. But that's what they want so I'll just try to make it work
somehow. Hopefully it will turn out ok.

-Mika

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Niklas Richardson
Sent: 10. elokuuta 2005 16:56
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Caret positioning problem

Mika,

I've just seen some wacky behaviour with using that function on the
keyUp.  If you type too quickly it skips adding the period.  Also, if
you try to delete (backspace) after typing, you get into a loop or it
recreating the period.  However, if you hit backspace really quickly
you can get past it! :)

Something to watch out for!

Cheers

Niklas


On 10/08/05, Niklas Richardson [EMAIL PROTECTED] wrote:
 Yeah, I just found that if you split the two commands into separate
 functions, and associate them with the click event on two bottons.
 Then pressing the first button (to add the dot) and then pressing the
 second button (to select the end of the string), then it works.
 
 Nice find on the redraw().  What made you think of that?
 
 If you set the first number in setSelection() then it will just give
 you a single caret rather than selection the whole text.  Like Allen
 suggested earlier.  This is the code I used to get it working (using
 your redraw() trick Philippe).  You don't need to use the FocusManager
 then either (okay, so you only save one line).
 
 myText.text = myText.text + '.';
 myText.redraw();
 Selection.setFocus(myText);
 Selection.setSelection(myText.text.length, myText.text.length);
 
 Cheers
 
 Niklas
 
 
 
 On 10/08/05, Philippe Maegerman [EMAIL PROTECTED] wrote:
 
  Don't ask me how I found it, I tried all kind of things like
setInterval,
  doLater etc ...
 
  MyTextField.text = MyTextField.text + .;
  MyTextField.redraw();
  var fm = getFocusManager();
  fm.setFocus(MyTextField);
  Selection.setSelection(0,MyTextField.text.length)
 
  Enjoy++
 
  Philippe Maegerman
  Web developer
  +32 2 400 40 39
  +32 472 35 28 10
  Avoir des rêves, c'est continuer d'exister...
 
 
   
   From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: mercredi 10 août 2005 15:27
 
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
 
 
  You wish…but  no, does not work (already tried it) L
 
 
 
  -Mika
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Philippe Maegerman
  Sent: 10. elokuuta 2005 16:16
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
  MyTextField.text.length+1 maybe ;)
 
 
 
  Philippe Maegerman
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: mercredi 10 août 2005 14:47
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
  Thanks, but it won't help. If I type in 23 my handler adds a dot to it
and
  the text becomes 23.
 
  Your code sets the 23 selected and caret is there (not after the added
dot
  as it should be), the thing is that it should show 23. and caret after
that,
  and no selection.
 
 
 
  -Mika
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Philippe Maegerman
  Sent: 10. elokuuta 2005 15:35
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
 
 
  var fm = getFocusManager();
  fm.setFocus(MyTextField);
  Selection.setSelection(0,MyTextField.text.length)
 
 
  Philippe Maegerman
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Allen Manning
  Sent: mercredi 10 août 2005 14:32
  To: flexcoders@yahoogroups.com
  Subject: RE: [flexcoders] Caret positioning problem
 
  Mika,
 
 
 
  Have you looked at:
 
 
 
  Selection.setSelection(stringLength,stringLength)
 
 
 
 
 
  HTH,
 
  Allen
 
  www.prismix.com/
 
 
 
   
 
 
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
  Behalf Of Mika Kiljunen
  Sent: 10 August 2005 13:25
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Caret positioning problem
 
 
 
  Hi,
 
  I'm trying to set the caret to the end of the textfield. I have a keyUp
  event handler that adds the dot . automatically for the text entered.
The
  problem is that when the dot is added by actionscript the caret stays
behind
  the added dot while typing, so the dot gets misplaced and the typing
comes
  out wrong. How can I position the caret AFTER the autoinserted dot? I've
  tried to fool around with the Selection class functions but none of it
seems
  to help..
 
 
 
  Here is an example of the handler I'd like to use:
 
 
 
  function onKeyUp( event )
 
  {
 
  if( MyTextField.text.length == 2