I believe that the text events for arrow keys are not cancelable,
unfortunately. I ran into this when trying to write an autocomplete
control.
 
-Sho


________________________________

        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Darron J. Schall
        Sent: Thursday, December 07, 2006 8:05 AM
        To: [email protected]
        Subject: Re: [flexcoders] TextArea as Console: Controlling
cursor position and intercepting arrow keys
        
        

        Since TextEvents are cancellable, you can also look at using 
        event.preventDefault(); in the TEXT_INPUT event handler to stop
the 
        Flash Player from automatically moving the cursor when the up
key is 
        pressed.
        
        -d
        
        Daniel Freiman wrote:
        >
        > What you're looking for is setSelection() to set the cursor
position. 
        > Simply put the same value in for the start and end value to
place the 
        > caret instead of the selection. However I'm not sure this is
going to 
        > be as responsive as you like. You may want to consider using a

        > different design such as having the history in a textarea and
having 
        > the user input in a textinput to simplify this problem.
        >
        > - Dan
        >
        > On 12/7/06, *chuvakgu* <[EMAIL PROTECTED]
<mailto:Grisha%40alum.mit.edu>  
        > <mailto:[EMAIL PROTECTED] <mailto:Grisha%40alum.mit.edu> >>
wrote:
        >
        > Hi all,
        >
        > How does one control position of the cursor inside a
mx:TextArea?
        >
        > What I am really trying to do is create a console
        > out of a TextArea. A user would enter commands at a
        > prompt, and at some point they would be sent to
        > the server for evaluation. I looked for something like this
        > but didn't find...
        >
        > So, control of cursor will come in a case such as:
        > I want to use up-arrow as history, for example, but while
        > I can intercept the up-arrow on a keyDown or keyUp event
        > and show the item from history, the cursor still moves.
        > In this case, maybe intercepting the arrow's
        > defautl behavior is good enough, but in another case
        > (e.g., if a line ends with \, the next line is indented -
        > but the cursor by default is in the first column, but whne
        > I mouse click on the area, it ends up in the proper place).
        >
        > Thanks.
        >
        >
        > 
        
        

         

Reply via email to