cursor-position

How to find cursor position in a contenteditable DIV?

Hello, I am writing a autocompleter for a content editable DIV (need to render html content in the text box. So preferred to use contenteditable DIV over TEXTAREA). Now I need to find the cursor position when there is a keyup/keydown/click event in the DIV. So that I can insert the html/text at that position. I am clueless how I can fin...

What's the most efficient way to track the mouse cursor position on Windows?

In Mac OS X's Cocoa Framework, there are Tracking Rects, which effectively allows you to register an area of your view and get callback messages when the mouse enters or leaves. Is there a similar API in Windows? I'd like to avoid using a timer to call GetCursorPos() every x interval. It could be that they're named something totally di...

C linux cursor position

Hi I want to print current time (by using printf) in same place, but i want to do it in infinite loop eg: while(1) {printf("Date and Time are %s", asctime(localtime(&current))); } . So before i use printf i should move cursor backward to its staring position. How to do it ? thx in advance ...

Problem on "Finding cursor position" function

Hi all, Few days ago, I have found a solution to obtain the cursor position on a div with contentedit="true". I use the solution defined on this web site : Finding cursor position in a contenteditable div function getCursorPos() { var cursorPos; if (window.getSelection) { var selObj = window.getSelecti...

anchorOffset doesn't function on text with HTML tags

Hi all, I have a problem with a little function which should give me the Cursor position : function getCursorPos() { var selObj = window.getSelection(); alert (selObj.anchorOffset); } It works only when I use it on a text whitout HTML tags. For example : "The cat is black" If I use...

Javascript onscroll and mouse position

I have a script that runs a addEventListener for onmousemove and onscroll on the document body to get the cursor position. A onmousemove event works fine (client + scroll), however when a onscroll event occurs clientX/Y seems to inherit scrollTop/Left values instead (only scroll). Is there a way around this? clickDocument = (document.do...

Saving cursor state with activity instance?

I've got an android app that pulls a random 20 questions (rows) as a cursor from a SQLite DB and loops through all the questions to ask the user all 20 questions. Is there some way to save the cursor's state/location when the activity is paused or stopped so that when the activity resumes the cursor is restored and in the same position ...

Setting the Cursor Position in a Win32 Console Application

How can I set the cursor position in a Win32 Console application? Preferably, I would like to avoid making a handle and using the Windows Console Functions. (I spent all morning running down that dark alley; it creates more problems than it solves.) I seem to recall doing this relatively simply when I was in college using stdio, but I...

How to scroll to the new added item in a ListView

Hi all My application show a ListView with a button which allow user to add an element. When the user clicks on this button, another Activity is started to allow user to populate the new element. When the add is finished, we return to the previous Activity with the ListView and I would like to scroll to the new element. Note that this ...

Set the caret/cursor position to the end of the string value WPF textbox

I am try to set the caret/cursor position to the end of the string value in my WPF textbox when I open my window for the first time. I use the FocusManager to set the focus on my textbox when my window opens. Nothing seems to work. Any ideas? Note, I am using the MVVM pattern, and I included only a portion of the XAML from my code. ...

C# Moving Cursor in RichTextBox on Right-Click

I have a RichTextBox control. When you left-click in the text the cursor jumps to where you clicked. I want this to happen when I right-click as well. I'm not sure how to do this. Thanks! ...

Set the cursor on a textbox after selecting an item in a ListBox

When I select an item on my Listbox, a Textbox is filled with the selected text for editing. How can I get the cursor to focus on the Textbox text so I don't have to click on it with my mouse before editing? ...

Tkinter set cursor position?

Hi Is it possible to set the cursor position in a Tkinter Text widget? I'm not finding anything terribly useful yet. The best I've been able to do is emit a <Button-1> and <ButtonRelease-1> event at a certain x-y coordinate, but that is a pixel amount, not a letter amount. Any help would be welcome, Thanks ...

Customize the Cursor flow / direction on pressing enter in Excel worksheet / table grid using Excel VBA

I have a column as follows : Column A---------------Column B 100 ----------------- 500 200 ----------------- 600 AA ----------------- ABCD BB ----------------- DEFG CC ----------------- FF DD ----------------- GG EE -----------------II 300 ----------------- 700 400 ----------------- 800 I want the Cursor to be present at cell location...

How to move screen without moving cursor in Vim ?

Hi, I recently discovered Ctrl+E and Ctrl+Y shortcuts for Vim that respectively move the screen up and down with a one line step, without moving the cursor. Do you know any command that leaves the cursor where it is but moves the screen so that the line which has the cursor becomes the first line ? (having a command for the last line w...

Set cursor position in Mac OS

Hi, I want to write a little vnc similar program that moves the Mac OS cursor to a position (x, y) given through a protocol which gets data from Bonjour service. The problem is that I don't know how to move the cursor! I'm working with Cocoa. Thanks for help! ...

Change cursor position in the contenteditable div after changing innerHTML

Hello, I have a simple contenteditable div with some text in it. On onkeyup event i want to replace whole content (innerHTML) of the div based on regex. For example, HTML: some text, more text and $even more text Function in which i plan to get all text with $ ($even in example above) and wrap it in span tag: div.onkeypress = fun...

VS: cursor position when override method is generated

My cursor (the pipe) is inside the body of the child class. public class BarContext : FooContext { | } I type "override" and press tab to view a list of methods in FooContext which I can override. "Context" is one of the options, so I select that. public class BarContext : FooContext { protected override void Context() { ...

How to get current mouse cursor coordinate in C#?

How to get current mouse cursor coordinate in C#? ...

Get caret position in contentEditable div

Hi, I'm finding tons of good, crossbrowser anwers on how to SET the cursor or caret position in a contentEditable DIV, but none on how to GET or find its position... What I want to do is know the position of the caret within this div, on keyup. So, when the user is typing text, I can at any point know its cursor's position within the...