caret

How do I make the caret of a JTextComponent skip selected text?

假如想象 提交于 2019-12-10 10:11:22
问题 the normal behaviour of native text fields in many environments is as follows: Textfield with text "abcdefg". I use the mouse to select "efg" from left to right. The caret is now behind "g". When I move the caret to the left by pressing the cursor left key once, the selection is removed and the caret is right before "e". When I do the same in a JTextField or JTextArea (tested on Mac OS) doing the exact same thing results in the caret being right before "g". I know how I could change that

Set Cursor position after nested contentEditable

血红的双手。 提交于 2019-12-10 04:16:59
问题 I've got this markup <div contentEditable="true"> Some other editable content <div class="field" contentEditable="false"> <span class="label">This is the label</span> <span class="value" contentEditable="true">This is where the caret is</span> </div> <!-- This is where I want the Caret --> </div> The caret is currently in the .field span. I need to move it back out after the .field in the parent contentEditable . How can this be accomplished via javascript (with the use of jQuery if needed) ?

Div Editable and More… More

杀马特。学长 韩版系。学妹 提交于 2019-12-08 15:24:32
Well, I need to replace a word, in a div contentEdible property on, by the same word but formatted... Like this: <div> My balls are big </div> To this (replace the word: balls): <div> My <font style="color:blue;">balls</font> are big </div> In a contentEditable this happens dinamically, while the user type the text the replacements happens. I think that a simple event onkeydown, onkeyup, or onkey press, can solve this part. But, the trouble is with the caret, that after all that i tryed, it stay before the word replaced, when should be stay after. I tryed write some js code, tryed find some

How To Get Caret Cursor Height In TextBox Using C#?

最后都变了- 提交于 2019-12-08 13:55:39
问题 I have some textBox having multiple line feature on with having different font size. Now I want to know the caret cursor height of this textbox text as its a simple text box so caret cursor will be able to resize as per font change etc and in other words I want to know the line height of the textBox or the font size of textBox. int fontHeight ; using (Graphics g = textBox1.CreateGraphics()) { float points = textBox1.Font.SizeInPoints; fontHeight = Convert.ToInt16(points * g.DpiX / 72); }

In Java Swing, can I receive Caret events in real time?

不问归期 提交于 2019-12-08 07:53:01
问题 I'm writing a hex editor-like view, which is composed of two JTextComponents (hex and ASCII). I'd like to synchronize the selection between the two views, so I've implemented a CaretListener for the two components. This works well for responding to selection events where the user has long-pressed, dragged, and released the mouse. The components receive the caretUpdate when the user releases the mouse. How can the components receive incremental caretUpdate events as the user presses the mouse

Set caret position in contenteditable div layer in Chrome/webkit

青春壹個敷衍的年華 提交于 2019-12-07 17:58:33
I'm trying to set the caret position in a contenteditable div layer, and after a bit of searching the web and experimenting I got it to work in firefox using this: function set(element,position){ element.focus(); var range= window.getSelection().getRangeAt(0); range.setStart(element.firstChild,position); range.setEnd(element.firstChild,position); } [...] set(document.getElementById("test"),3); But in Chrome/webkit it selects all of the content in the div. Is this a bug with webkit or am I doing something wrong? Thank you in advance. The offset of a Range boundary within a node is only a

Hiding caret in RichEdit winapi

廉价感情. 提交于 2019-12-07 15:30:38
I would like to hide a caret from a RichEdit(50W) with ES_READONLY style specified. It's pretty confusing for the user, when the caret is blinking and the user can't type. I tried to hide the caret using HideCaret() function, however it doesn't work for me with following code: LRESULT CALLBACK ChatMessaegsSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Subclassed control { LRESULT ret = CallWindowProc(WndProc_ChatMessages, hwnd, msg, wParam, lParam); switch(msg) { //Also tried with EN_SETFOCUS case WM_SETFOCUS: { ret = CallWindowProc(WndProc_ChatMessages, hwnd, msg, wParam,

How to get caret position within contenteditable div with html child elements in Internet Explorer

与世无争的帅哥 提交于 2019-12-07 07:05:31
问题 I am working with a contenteditable div that will have the option to have inline html elements such as tags " <p> <font> <br> " in the text flow. At certain points I need to grab the caret position(cursor position) of contenteditable div, the caret(cursor) is after an html child element. i am using following code in javascript for Firefox it works correctly to find caret position(cursor position) of contenteditable div, but i does not find any solution for Internet Explorer to find caret

Native caret position macos cocoa

给你一囗甜甜゛ 提交于 2019-12-07 06:59:10
问题 I want to be able to get the global caret position inside any application in Mac High Sierra using cocoa or appleScript. I already use NSEvent to get the keyboard and mouse hook but is there a way to get the caret position hook? The caret is different from the mouse position. It moves on key event or mouse click. In windows, you can get the caret position almost anywhere. I want to know if there is the equivalent for macos. I want to show a popup over the text caret, if i type on the keyboard

Hide QLineEdit blinking cursor

跟風遠走 提交于 2019-12-07 03:35:46
问题 I am working on QT v5.2 I need to hide the blinking cursor (caret) of QLineEdit permanently. But at the same time, I want the QLineEdit to be editable (so readOnly and/or setting editable false is not an option for me). I am already changing the Background color of the QLineEdit when it is in focus, so I will know which QLineEdit widget is getting edited. For my requirement, cursor (the blinking text cursor) display should not be there. I have tried styleSheets , but I can't get the cursor