cursor-position

How to move screen without moving cursor in Vim?

陌路散爱 提交于 2019-12-28 07:11:58
问题 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 would be a nice bonus). I can achieve this by manually pressing Ctrl + E (or Ctrl + Y ) the proper number of times, but having a command that somehow does this

Eclipse-plugin how to get current text editor cursor position

北城余情 提交于 2019-12-28 06:49:08
问题 I try to show popup dialog at text cursor position of an editor. How can I get text cursor position in pixels of the active editor (Point) and a show popup dialog at this point? 回答1: I'm not exactly sure what do you mean under "show popup dialog at this point", but do something like this: IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor instanceof ITextEditor) { ISelectionProvider selectionProvider = ((ITextEditor)editor)

how to find xy position in javascript with offset

痴心易碎 提交于 2019-12-22 13:49:36
问题 hello i have some problem with my javascript code.. i want to get xy position the selected text in javascript, and i use offside function like this : function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj

Android EditText's cursor coordinates (absolute position)

心已入冬 提交于 2019-12-22 10:48:33
问题 How can I get the coordinates of the cursor in the EditText ? I am not trying to get the cursor position here but the EditText coordinates of the cursor. In my case, when I send a number via KeyEvent to the EditText, the cursor position (getSelectionStart) is changed, but its location is always at the right of the EditText. I want to know the coordinates of the cursor (the right of the EditText). 回答1: It's a little bit late answer :), but from API level 21 (Lollipop) there is a way to do it:

Simulate mouse click in MSPaint

ぐ巨炮叔叔 提交于 2019-12-21 05:23:14
问题 I have a console application which should paint a random picture in MSPaint (mouse down -> let the cursor randomly paint something -> mouse up. This is what I have so far (I added comments to the Main method for better understanding what I want to achieve): [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, uint dx, uint dy, long cButtons, long dwExtraInfo); private const int MOUSEEVENTF_LEFTDOWN = 0x201; private const

Make Object Follow Mouse On MouseDown and “Stick” On MouseUp

人盡茶涼 提交于 2019-12-20 03:23:38
问题 I'm working with a project that is WPF and VB.net. I want to visually simulate "dragging" an object (though I do not want to use standard drag and drop for reason of purpose). Basically, I have a label object that, on its MouseDown event, I want it to follow the mouse cursor inside a 640x480 solid-size grid (but not outside of it!). Mind you, this grid is centered inside a full-screen window. Again, the object should not follow the mouse outside of the grid (I'm guessing a "ClipToBounds =

tinyMCE - get content up to cursor position

瘦欲@ 提交于 2019-12-20 02:32:10
问题 I am making a little word prediction plugin for tinyMCE and need to extract a bit of text and later insert text from a list of predicted words. The insertion should be no problem, as I know where the cursor is and can use the mceInsertContent command. Getting the text for the prediction however... I need to extract a subset of the text ending at the letter immediately before the cursor position and starting at, well, the start of the text. I can strip HTML tags myself if neccessary, but I

Setting cursor at the end of any text of a textbox [duplicate]

我们两清 提交于 2019-12-18 10:21:18
问题 This question already has answers here : Set the caret/cursor position to the end of the string value WPF textbox (6 answers) Closed 6 years ago . I have a text box with a displayed string already in it. To bring the cursor to the textbox I am already doing txtbox.Focus(); But how do I get the cursor at the end of the string in the textbox ? 回答1: For Windows Forms you can control cursor position (and selection) with txtbox.SelectionStart and txtbox.SelectionLength properties. If you want to

How to get mouse position over a certain control

独自空忆成欢 提交于 2019-12-18 05:59:25
问题 Windows Form I'm using the DragOver event on a layoutpanel and the DragEventArgs returns the X/Y coordinates of the mouse in relation to the screen. I know there is a function to translate this in to the position of the mouse over the control, but I'm having difficulty locating it. 回答1: Try Control.PointToClient and Control.PointToScreen. 来源: https://stackoverflow.com/questions/465545/how-to-get-mouse-position-over-a-certain-control