selection

Go to a item in Listview without using smoothScrollToPosition

两盒软妹~` 提交于 2019-12-19 10:37:06
问题 I'd like to go to (display) a specific item in my listview but without scrolling. I don't want any animation but I'd like to be instantaneously transported to the desired item. I'm using a checkable listview : mylistview.setChoiceMode(1) . I understood that mylistview.setSelection(position) is the solution, but when I use it, nothing happens (maybe because it's a checkable listview ?). When I use mylistview.smoothScrollToPosition(position) , it works well but I have obviously this scroll

How do you retrieve the selected text in MATLAB?

社会主义新天地 提交于 2019-12-19 03:24:06
问题 MATLAB has several selection-sensitive capabilities. For example, if you select some text and press F9, it evaluates your selection. (Unless you've remapped your keyboard settings.) I'd like to be able to replicate this functionality with for a shortcut. So, for example, I want to click a shortcut that displays the current selection. My shortcut callback would be disp(GetSelection()) . But what goes into GetSelection ? 回答1: Thanks to @Yair Altman's undocumented Matlab, I was able to figure

How to retain selected text in JTextField when focus lost?

百般思念 提交于 2019-12-19 02:47:07
问题 Now finishing my custom menu popup, but the problem is that if I select some text in JTextField and click mouse button to show popup menu, then focus is transferred to popup window, AND selected text before are no longer highlighted. When focus is back to JTextField - selected text become highlighted again. How to make the selected text stay highlighted on focus lost? 回答1: then focus is transferred to popup window, AND selected text before are no longer highlighted. When focus is back to

Create TextSelection from selection in IE11

本秂侑毒 提交于 2019-12-18 17:12:08
问题 I am trying to fix an application in IE11 and I stuck in this bug: In the older version of IE ther was a simple selection object but it is deprecated in IE11. The MSDN page offer to use getSelection instead of that, but it is not the same. I need to create a TextRange based on the selection and in the old API there was a simple solution: // there is a TextRange object what I need var textRange = document.selection.createRange(); The new HTMLSelection object has no createRange() method and I

Create TextSelection from selection in IE11

試著忘記壹切 提交于 2019-12-18 17:11:35
问题 I am trying to fix an application in IE11 and I stuck in this bug: In the older version of IE ther was a simple selection object but it is deprecated in IE11. The MSDN page offer to use getSelection instead of that, but it is not the same. I need to create a TextRange based on the selection and in the old API there was a simple solution: // there is a TextRange object what I need var textRange = document.selection.createRange(); The new HTMLSelection object has no createRange() method and I

How do I apply a style to multiple selections in Word using VBA?

感情迁移 提交于 2019-12-18 13:50:36
问题 I created a macro that will apply a particular style to whatever is selected in the document. However, when in draft view, when the user clicks in the style area pane to select a paragraph and then Ctrl + clicks on an additional paragraph, this additional selection is not applied when this macro is run: Sub BodyTextApply() Selection.Style = ActiveDocument.Styles("Body Text,bt") End Sub What do I need to add to this? Note: The workflow cannot change so that the user selects that actual text in

Pyqt get pixel position and value when mouse click on the image

試著忘記壹切 提交于 2019-12-18 13:32:21
问题 I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value. Thanks 回答1: self.image = QLabel() self.image.setPixmap(QPixmap("C:\\myImg.jpg")) self.image.setObjectName("image") self.image.mousePressEvent = self.getPos def getPos(self , event): x = event.pos().x() y = event.pos().y() 回答2: First you have to draw the image. You can do this my making a QLabel widget and call setPixmap . You need to convert your QImage to QPixmap before

How to select or highlight a block in Emacs?

假如想象 提交于 2019-12-18 10:01:30
问题 I want to select or highlight a block in emacs without using mouse but doing it from the keyboard like vim's visual mode. What is the easiest way to do this from a keyboard? 回答1: Take a look at region-rectangle in emacs. In short, you start selection like usual with Control - Space , then kill region with Control - x r k and paste (or yank ) killed block with Control - x r y . 回答2: If I understand the question correctly, it is not about rectangular regions originally. C-Spc puts a mark at the

Text selection listener in Android(API level 7)

∥☆過路亽.° 提交于 2019-12-18 09:49:29
问题 I need a listener which is called every time the selection in an EditText changes. I googled around but I couldn't find anything useful for API level 7. I'm writing a Text Editor and I want the bold/italic/underlined button appear selected every time the user selects bold/italic/underlined text. 回答1: The better way to do it would be to extend the EditText and then based upon how you would want to manage the changing text, you could override one of the 2 methods to work out your customized

Listview - Multi column - Change selection color for the whole row

爷,独闯天下 提交于 2019-12-18 09:37:50
问题 I would like to change selection color in a ListView, from a default (blue). I can not adapt any code that I found to my needs. Here is the code that is closest. If e.Item.Selected = True Then e.Graphics.FillRectangle(New SolidBrush(Color.Gray), e.Bounds) TextRenderer.DrawText(e.Graphics, e.Item.Text, New Font(ListView2.Font, Nothing), New Point(e.Bounds.Left + 3, e.Bounds.Top + 2), Color.White) Else e.DrawDefault = True End If The main problem is e.Item.Text part. It doesn't work for multi