PDA

View Full Version : How to get part of inputtext content


epopov
12-29-2003, 08:38 AM
Hi,
I have inputtext in my application and I want to get part of text in this inputtext control.
For example user inputs to inputtext "Hello all" and selects "ello a". How to get this selected part?

Thanks.

antun
12-29-2003, 11:32 AM
Well really this is all about manipulating strings right? Once you retrieve the entered text from your inputtext, and store it in a variable, it becomes an instance of the String core ECMAScript object, whereupon you can use most of the String methods to play with it:


<canvas debug="true">
<script>
var foo = "Hello, world!";
var bar = foo.slice( 1, foo.length);
var ta = "'" + bar;
Debug.write( "foo: " + foo );
Debug.write( "bar: " + bar );
Debug.write( "ta: " + ta );
</script>
</canvas>


-Antun

epopov
12-29-2003, 01:24 PM
Actually I want to know how to determine some substring that is selected in inputtext(selected substring is substring that colored in other color when you select it).

antun
12-29-2003, 02:41 PM
There aren't any hooks for that at the moment. I think this is related to this issue:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=556

-Antun