Is it possible to get the caret position in pixels relative to the window. I need to get the caret position by space or by pressing the arrows. The thought arises whether it is possible to simulate a mouse click (since a mouse click has properties of the click coordinate) by pressing a space (that is, in a text field by pressing the space, the position of the caret changes), any ideas? This is necessary in order to position the block with a hint near the entered word. I managed to do this only by clicking the mouse, since I can get its coordinates
Related
I've searched all the settings and Google but can find nothing. It seems such an obvious feature. If I use the arrow keys to scroll vertically through the code, I quickly end up with the cursor at the top or bottom of the screen whereas I really want to be doing my editing near the centre of the screen, which means I have to do two operations: scroll the code to where I want it and then move the cursor.
What I want is to hit a shortcut (e.g. the Scroll Lock key) and then when I press up- or down-arrow the cursor stays where it is (relative to the screen) and the code scrolls past it.
I've read that some tools allow you to set the number of "always visible" lines above and below the cursor which would do the job, but I can't find that in Rider either.
Am I missing something obvious, or is there an add-in or something I can customize to get what I want?
Found it! There are Move Up and Scroll and Move Down and Scroll actions in the keymap settings. Assign hotkeys to them (weren't assigned in my config) and it will work like you described it.
i am really annoyed by weird caret / cursor behaviour inside IntelliJs editor.
The caret sometimes get stuck at some line at the beginning. If you try to navigate by arrow-keys or something else despite the mouse when this happens, the caret will instantly jump back to the previous position. Only way to set it free is to click with the mouse somewhere else in the editor window.
In addition to it, if the caret is stuck and you scroll, the caret moves the same amount of lines you scroll in the editor and will select all text on its way.
So the question is: what can i do about it?
env: macOS 10.12.4, recent JetBrains IDEs (tried several versions)
First of all, my problem is about the cursor, and not the caret.
-When I'm just hovering the RichTextBox, no movement, cursor is default.
-Whenever I'm moving over a character in the RichTextBox, the cursor changes from Arrow to IBeam.
-And when it comes to simply move (over space) in the RichTextBox, the cursor is changed to a symmetric one. It acts the same when clicking (right or left, doesn't matter)
How can I get rid of it ? I forced RichTextBox.Cursor to Arrow, I tried to play with RichTextBox.MouseHover event, but unfortunately nothing worked.
Thanks
Use Mouse_Move Event of RichTextBox
and set RichTextBox Cursor property to Arrow
If I have a form with a line drawn on it how can I select that line by clicking on it with a mouse button, so that I can then do things with it like delete or modyfy?
You need to do some maths to see if the clicked mouse point lies on the line in question:
http://forums.codeguru.com/showthread.php?419763-Check-a-Point-lies-in-a-Line-segment
However you may need to add some tolerance because the user may click one pixel away but still expect the line to be selected. Also you may need to think about what happens when two lines intersect or are drawn over one another?
I am looking for a way to get the caret x y coordinates inside a contenteditable div, in a similar manner to how you can get the mouse coordinates using window.event since I need to open a pop-up exactly where the user is with the caret inside the contenteditable div. How can I do this? Many thanks!
Here's one approach:
Coordinates of selected text in browser page
However, in some circumstances this will not give you coordinates, in which case you'd need to fall back to inserting an element at the caret, getting its position and removing the element again.