how to move caret programmatically



  • 1. Can't debug in FB3
    Hi, I installed FB3 3.0.1 plugin into Eclipse (Europe). I can run the application in FB3, but can't debug - get Error 404 "Requested resource is not available". I added argument "-debug=true" to Flex compiler, but still have a problem. Running in IE6 in WinXP. FB3 was supposed to install Debug version of Flash ActiveX plugin, it shows 9,0,115,0 (I assume it's Debug version). Please help. Thank you in advance, Oleg.
  • 2. Two simple questions
    I've started playing with Flex few hours ago. It's great platform, and documentation gives you opportunity to quickly learn all you need, but two (trivial) things are driving me mad: - How to display dialog window? I created my own <mx:Window /> class and want when user clicks on some button to display that window as dialog. Meaning - new window should take focus and not let it go until closed - it should be not possible for user to click or use parent window (that opened dialog) - How to block window and start playing some Loading... animation? I have operation which takes some time and want to have any kind of animation to block user data entry/window moving, and entertain him until operation is finished. Thanks in advance for answers!
  • 3. Add thousand separator as user types
    Dear all, Is there anyway we add a thousand separator on the TextInput as user is typing a number there? Could anybody give me a hint on how to do this? Thanks in advance.
  • 4. linger string objects
    I have a function that calls a httpService.. it pushes data into an array.. i clear the array with for ( a=0; myarray[a].pop(); a++); System.gc(); to try and free up the memory, but it isn't working... anyone have any ideas?

how to move caret programmatically

Postby apu2 » Sat, 13 Dec 2008 14:32:23 GMT

I am creating a Bengali editor using a Bengali font. A key input or a sequence 
of key inputs translates to a single Bengali character symbol or a basic 
character symbol with a modifier symbol.  I am using an event handler for the 
change event in TextArea object. In the event handler, I check the key typed , 
map it to the unicode(s) corresponding to the key or sequence of keys typed and 
put this unicode sequence back to TextArea.text . 
 The problem is that when , say the sequence "ko" is typed the two letters 
translate to 3 Bengali symbols. When I replace the "ko" with the 3 symbols, 
they show up alright but the caret or cursor shows up between symbol 2 and 3. 
For all other symbols, it works properly i.e. that caret shows up after the 
last symbol. So, in order to type, user has to manually press right arrow to 
move the caret to the right of 3rd symbol. Can it be done programmatically? 
What I want is I will map "ko"  to 4 rather than 3 symbols, the last being a 
non-printable unicode for right arrow. Is it possible? I could not find the 
unicode for non-printable right arrow. I just want to move caret one position 
to the right programmatically.

Re: how to move caret programmatically

Postby apu2 » Sat, 13 Dec 2008 21:34:32 GMT

I found the solution from another thread. 
ta.setSelection(ta.text.length, ta.text.length);
This sets the focus at the end of text in the text area

Similar Threads:

1.How do I keep main form richedit caret flashing when pressing button in 2nd form

I'm writing an application with custom skinned controls.
I have a text editor form with a rich edit control. Because there's no 
toolbuttons in the skinned control set, I have to use normal ones for 
Bold/Italic/Underline etc. Because they're normal buttons, they grab focus 
from the rich edit. So to prevent losing the caret Ive used the Validating 
event to cancel focus loss. This works great.
The application can be run in either terminal or desktop mode.
In terminal mode ie no physical keyboard, I have had to write a small 
keyboard window to allow the user to enter text/symbols.
When I switch to the 2nd form, the rich edit is still the ActiveControl on 
the main form but the caret vanishes from view.

Am I able to do anything similar here? The keypad window needs to behave in 
the same way they do in compact framework.


2.CARET (flashing text insertion) position: GetGUIThreadInfo problem


I need to track the Caret position (flashing text insertion point),

I go with GetGuiThreadInfo and it gives me the coordinates
of the caret and of the window that owns it,
then I convert them to screen coordinate,
so it's all OK.


if the window has another little window inside it, 
in example a meter on the top (like MS Works) 
or a dropdown combobox on the top (like the VB6 code editor; it has two
dropdown combobox indeed),

the resulting coordinate of the window that owns the caret
(Y coordinate in those cases)
is wrong: 
the height dimension of the little window is not considered.

How can I solve it?
With Notepad is all ok because it has no other window/object
inside it, but with more complex windows...?

3.Textfield caret missing in Mozilla and Mozilla Firefox browsers

4.Textfield caret missing in Mozilla and Mozilla Firefox browsers

Standard textfields don't have a caret on those browsers.
Anybody knows a quick solution for this?

5.Input text fields: problem with caret position


 I have two input text fields on the stage with embedded char sets.  When I 
switch fields with a right-click the caret does not blink at the correct 
position. It blinks sometimes after the second, sometimes after the third 

 When I do not embed the characters everything works fine. But I want to use 
embedded char sets...

 Has anyone a solution for me?


6. Customization of TextInput Caret

7. Textfield caret missing in Mozilla and Mozilla Firefox browsers

8. Caret is not visible in Flash-Object within Director Movie

Return to flex


Who is online

Users browsing this forum: No registered users and 52 guest