9 Replies Latest reply on May 21, 2010 12:21 AM by BhaskerChari

    Mouse Cursor in Text Area

    Nirmal Kumar Bhogadi

      Hello All.

       

      I am working on a TextArea component. My requirement is when I click at some point on the Text Area, I should be able to write text from that position. Can someone help me in this respect.

       

       

      Thanks in advance,

      Nirmal Kumar Bhogadi.

        • 1. Re: Mouse Cursor in Text Area
          Flex harUI Adobe Employee

          How is that different from our default TextArea?

          • 2. Re: Mouse Cursor in Text Area
            Nirmal Kumar Bhogadi Level 1

            Its the default TextArea of Flex.

            • 3. Re: Mouse Cursor in Text Area
              BhaskerChari Level 4

              Hi Nirmal,

               

              If you are using the default TextArea then what's the problem in that ...when you click at any point inside the TextArea the cursor starts blinking at that position...and if you start typing then text will start from that point itself...then what's the difference you noticed it couldn't come to mind...:)

               

              Thanks,

              Bhasker Chari

              • 4. Re: Mouse Cursor in Text Area
                Nirmal Kumar Bhogadi Level 1

                Say my TextArea has already some text in it. Then when I click, the cursor will appear at the end of the text. Not at the place where I click.

                 

                 

                • 5. Re: Mouse Cursor in Text Area
                  Axxay

                  Hi

                  I think what is required here is to give ability to type texts anywhere in the text area by clicking on any position in textArea. We can type in textArea starting from top left corner only(and then we can move further on right side and next line). we can not click anywhere in the textArea using mouse and start typing from there(we can do this only if something is already typed at this position, i.e. space or some text).

                  But I was just thinking why this kind of ability is needed to type from anywhere in textArea. The default textArea is good enough to work with !!!

                   

                  Thanks.

                  • 6. Re: Mouse Cursor in Text Area
                    BhaskerChari Level 4

                    Hey have you tested it correctly ...when you already have some text typed in TextArea and if you click any where in textarea where the text is availabel then the cursor will appear at that position. But if you clcik somewhere after the text where the text is not available then the cursor will be at the end of text.

                     

                     

                    Its, funny....:)

                     

                    Thanks,

                    Bhasker Chari

                    • 7. Re: Mouse Cursor in Text Area
                      Nirmal Kumar Bhogadi Level 1

                      Well, my requirement is like that. in Flash we have something like getCharIndexAtPoint which will serve the functionality. But it is restricted to TextField and TextField has no editable property. i.e., the TextFiled cannot be made uneditable . It is always in the editable mode. I want to use TextArea so that it can be made as editable and uneditable. But I am not able to find  getCharIndexAtPoint for TextArea in Flex.

                      • 8. Re: Mouse Cursor in Text Area
                        BhaskerChari Level 4

                        Hey Nirmal,

                         

                        Dont worry let me help you if your things gonna work if you have textFiled then this is the work around for you..

                        you can get the textfield instance for your textArea by using the below code.

                         

                         

                        var textField:TextField = textArea.mx_internal::getTextField();

                         

                         

                        After this you can make use of the textField variable to perform any operations on your TextArea.

                         

                        If this post answers your question or helps, please kindly mark it as such.

                         

                        Thanks,

                        Bhasker Chari

                        1 person found this helpful
                        • 9. Re: Mouse Cursor in Text Area
                          Axxay Level 1

                          A quick workaround if you do not find a good solution for this.

                           

                          <?xml version="1.0" encoding="utf-8"?>

                          <mx:Application

                           

                           

                          xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

                           

                           

                          <mx:TextArea id="txtArea" text="                                           &#xa;                                                  &#xa;                                                &#xa; " />

                          </mx:Application>

                           

                           

                          Thanks.

                          1 person found this helpful