textselection

C# Windows Forms DateTimePicker, how to get the SelectedText, SelectionStart, and SelectionLength?

拟墨画扇 提交于 2020-05-16 22:04:42
问题 The .NET DateTimePicker has Text, but I cannot figure out how to get and set the SelectionStart, SelectionLength, and SelectionText properties for the DateTimePicker. For example, how can I programmatically select the 2 day digits in the date "11/17/2001"? and how can I programmatically determine the currently selection start position? Essentially, what I would like to do is something like the following code: // Select the day's text ((TextBox)myDateTimePicker).SelectionStart = 3; ((TextBox

C# Windows Forms DateTimePicker, how to get the SelectedText, SelectionStart, and SelectionLength?

谁说胖子不能爱 提交于 2020-05-16 22:04:31
问题 The .NET DateTimePicker has Text, but I cannot figure out how to get and set the SelectionStart, SelectionLength, and SelectionText properties for the DateTimePicker. For example, how can I programmatically select the 2 day digits in the date "11/17/2001"? and how can I programmatically determine the currently selection start position? Essentially, what I would like to do is something like the following code: // Select the day's text ((TextBox)myDateTimePicker).SelectionStart = 3; ((TextBox

Why getting a text selection from textarea works when a button clicked but not when a “div” clicked (in Internet Explorer)

元气小坏坏 提交于 2020-01-21 19:19:12
问题 Consider the following code: (Live demo here - Open in Internet Explorer 7 or 9) HTML: <textarea>Hello Stack Overflow</textarea> <input class="a" type="button" value="Click here does the job" /> <div class="a">But clicking here not :(</div> JS: function getInputSelection(el) { var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { start = el.selectionStart; end = el.selectionEnd; } else {

android webview: prevent text selection actionMode actionBar

你离开我真会死。 提交于 2020-01-12 18:43:39
问题 I want to preserve the text selection in a webView while preventing any contextual menu of the actioMode from being shown. Neither the new floating one nor the old actionBar, just the selection handles and of course the selection behaviour. Hooking to the actionModeCallback in startActionMode allows me to clear all items in the menu in the callback onCreateActionMode. This works fine on android 6, since an empty floating menu won't show at all, and the actionMode text selection behaviour is

Text selection not happening properly because of custom line spacing in UITextView

扶醉桌前 提交于 2020-01-03 03:01:13
问题 I have a custom UITextView with custom line spacing applied. When I try to select the text the selectionRect is wrong. Check this image where highlighting is correct but the size of the handles at selectionRange start and end is wrong. That particular line has beforeSpacing of 50px and afterSpacing of 10px applied. Instead I want it to behave like this I modified the cursor size using caretRectForPosition: and modified the position and size of the cursor by changing its rect, but

Making a rectangular selection in a RichTextBox with Alt-Left-Mouse sweep?

最后都变了- 提交于 2020-01-01 11:03:11
问题 There are quite a few applications that allow you to select a box or rectangle of text by sweeping with mouse while the Alt key is pressed. Visual Studio 2010 does this in the code editor, for instance. Emacs does it. Winword does it. We've all seen it. It seems like there must be a standard pattern to follow to encode this behavior but I cannot seem to find it. I suspect I am not Googling with the correct keywords as all I am getting are false hits on rectangle, Alt-Left, sweep, selection,

How to clear the selection in an EditText?

旧城冷巷雨未停 提交于 2020-01-01 09:32:47
问题 How do you programmatically remove the selection from an EditText ? I've tried: myEditText.setSelection(selectionEnd); but that just creates a selection of 0 length at the end of the current selection. I've also tried Selection.removeSelection(mySpannable) , and it just puts an empty selection at the beginning of the text. 回答1: Calling myEditText.clearFocus(); . I think that's what you need 回答2: To move selection to top: edit_text.setSelection(0); To move selection to bottom: edit_text

How do you override “-moz-user-select: none;” on a child element?

删除回忆录丶 提交于 2019-12-30 01:59:08
问题 The question CSS rule to disable text selection highlighting shows how to prevent text selection on an element. Once you have prevented selection, how can you then allow selection for a specific child element? For example, <div class="no-select"> <p>some text that cannot be selected</p> <p class="select">some text that can be selected</p> <p>some text that cannot be selected</p> </div> table.no-select { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz

With Rangy, even though I extend the range by setStartBefore method, range.canSurroundContents method still returns false

北慕城南 提交于 2019-12-24 22:52:12
问题 I have the following html: <p>Morbi quis augue vitae quam <a href="#">pharetra| varius</a> at at| urna.</p> The selection is marked with | characters. Also a screenshot of the selection: I can extend this selection to contain the whole 'a' element with the following code snippet (using Rangy library http://code.google.com/p/rangy/): $('body').on('mouseup', '[contenteditable]', function() { var block = this, sel = rangy.getSelection(), range = sel.getRangeAt(0); if (sel.anchorNode.parentNode !

Text selection tools in ActionBar are white on white background after selecting text in Dialog

半世苍凉 提交于 2019-12-24 11:37:14
问题 Anyone had this issue, that after selecting text in dialog's EditText, toolbar appears with invisible action buttons (white on white background)? How do I set theme to a DialogFragment? 回答1: You can custom dialog theme in styles.xml: <style name="MyDialogTheme" parent="android:Theme.Holo.Dialog" /> then use MyDialogTheme in your DialogFragment UPDATE In your dialog use following codes to set custom theme: ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), R.style