473,230 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Revealing the position of the cursor in a text-area

PeP
Good morning,
I have a form containing a text-area,
I'd like to know if it exists a function that, when I activate an event,
returns the position of the cursor in the text-area.

For example, I write ten words in the text-area,
then I move the cursor at the beginning of the second word
and activate the event (for example, click on a button):
is there a way to know that the cursor is at the beginning of the second
word?

I know that the text-area is considered as a string,
so I want the position of the cursor in that string
at the moment of the event activation.

I hope I was clear.
Thanks in advance to all readers
Jul 23 '05 #1
3 4864
"PeP" <io****@inwind.it> wrote in message news:<4J*********************@twister2.libero.it>. ..
Good morning,
I have a form containing a text-area,
I'd like to know if it exists a function that, when I activate an event,
returns the position of the cursor in the text-area.

For example, I write ten words in the text-area,
then I move the cursor at the beginning of the second word
and activate the event (for example, click on a button):
is there a way to know that the cursor is at the beginning of the second
word?

I know that the text-area is considered as a string,
so I want the position of the cursor in that string
at the moment of the event activation.


Having just had to do this for an intranet page where we wanted
to be able to click on terms in a list and have them insert into
a textarea at the cursor position (for an internal wiki), I can
tell you that it is possible, but only in IE unless you replace
the textarea with a _Java_ based editor.

See http://www.faqts.com/knowledge_base/...d/1052/fid/130
for a starting point. The IE code appears to be based on Microsoft's
own code at http://msdn.microsoft.com/library/de...am12032001.asp
(see "O Cursor Where art thou?")

This works, but it's not very nice or easy.
Jul 23 '05 #2
PeP
"MikeT" <ne**@chthonic.f9.co.uk> ha scritto nel messaggio
news:af**************************@posting.google.c om...
"PeP" <io****@inwind.it> wrote in message news:<4J*********************@twister2.libero.it>. ..
Good morning,
I have a form containing a text-area,
I'd like to know if it exists a function that, when I activate an event,
returns the position of the cursor in the text-area.

For example, I write ten words in the text-area,
then I move the cursor at the beginning of the second word
and activate the event (for example, click on a button):
is there a way to know that the cursor is at the beginning of the second
word?

I know that the text-area is considered as a string,
so I want the position of the cursor in that string
at the moment of the event activation.


Having just had to do this for an intranet page where we wanted
to be able to click on terms in a list and have them insert into
a textarea at the cursor position (for an internal wiki), I can
tell you that it is possible, but only in IE unless you replace
the textarea with a _Java_ based editor.

See http://www.faqts.com/knowledge_base/...d/1052/fid/130
for a starting point. The IE code appears to be based on Microsoft's
own code at

http://msdn.microsoft.com/library/de...us/dnwebteam/h
tml/webteam12032001.asp (see "O Cursor Where art thou?")

This works, but it's not very nice or easy.


Thank you Mike, I'm afraid I posted a FAQ (since 1998) and I'm sorry
in fact I found the same solutions you provide, doing a simple search with
Google.
Anyway I appreciate your attention and suggestion

Best regards
Jul 23 '05 #3
PeP
[cut]
For example, I write ten words in the text-area,
then I move the cursor at the beginning of the second word
and activate the event (for example, click on a button):
is there a way to know that the cursor is at the beginning of the second
word?

I know that the text-area is considered as a string,
so I want the position of the cursor in that string
at the moment of the event activation.

Having just had to do this for an intranet page where we wanted
to be able to click on terms in a list and have them insert into
a textarea at the cursor position (for an internal wiki), I can
tell you that it is possible, but only in IE unless you replace
the textarea with a _Java_ based editor.

See http://www.faqts.com/knowledge_base/...d/1052/fid/130
for a starting point. The IE code appears to be based on Microsoft's
own code at

http://msdn.microsoft.com/library/de...us/dnwebteam/h
tml/webteam12032001.asp (see "O Cursor Where art thou?")

This works, but it's not very nice or easy.


I found this
http://www.faqts.com/knowledge_base/...html/aid/13562
to be better than your first suggested link.
Bye
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jason | last post by:
I've got this javascript routine (i found on google - thank you) in an asp.net page that on page reload sets the cursor of a textbox to the last line. It works great! Using a similar concept, I...
0
by: Dusan Mihajlovic via .NET 247 | last post by:
Is it posible to set cursor position on the begining of selectedtext of text box. For example, I have text TEST in text box. Iwant to select ES character and cursor position between T and...
2
by: AP | last post by:
I am trying to find the integer value for the cursor position in a text box, in particular I want to find out if I am at the end of some text that I typed or at the beginning. I am using IE 6. ...
7
by: Steve | last post by:
does any one know a way to determine the position of the cursor in a text box. I would like to position a list next to the current position for context commands. I am using...
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
4
by: Billy | last post by:
Hi all, I'm building a text file from a database table using the ASP Write Method and would like to position the cursor in a specific column position before writing the fields. As I loop through...
4
by: Ubi | last post by:
Hi guys, I am loading a page with textareas containing text. By the default, the cursor goes at the beginning of the text. I would like to position the cursor at the end of the text instead. ...
4
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end...
0
by: Alex9968 | last post by:
Is it possible to get position (in numbers) of the insertion cursor? As I understood, Text widget uses mark named INSERT to store it, which is available globally by just referencing INSERT, but how...
0
by: nagarjunt | last post by:
Hi, This is nag. I have a problem with infragistics7.1 UltraTextEditor control. I am using C# code in windows form. I have UltraTextEditor control(With multi line enabled) in my Windows...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.