Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

How can I get keyboard cursor(caret) position in javascript?

$
0
0

Hi. I have a question.

 

How can I get keyboard cursor(caret) position in javascript?

 

I made a multilined edittext in ScriptUI.

 

But It's not working about Enter key.

 

 

All I want is when I push 'enter' key, begin a new line.

 

If I know how to get keyboard cursor position, I can insert '\n' character in middle of sentances.

 

 

/////////////////////////////////////////////////////////////////////////////////////

 

var win =new Window ("dialog", '');

          win.orientation = "column";

 

 

var grpContents = win.add("group")

          var codeInput = grpContents.add ("edittext", [0, 0, 150, 550], "", {multiline:true});

                    codeInput.alignment = ['fill', 'top']

                    codeInput.active = true;

                   codeInput.onEnterKey = function(){

            codeInput.text = codeInput.text+"\n"

     }

 

          win.show()

 

/////////////////////////////////////////////////////////////////////////////////////

 

 

 

I use windowsXP and Illustrator CS3.

 

 

If you know about that, please help me!~


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>