selection

Can I set the selected item for a JList without having an event thrown to the listeners?

﹥>﹥吖頭↗ 提交于 2019-12-01 20:03:50
I am working on a viewer, which uses a JList to show thumbnails of the pages of a document. The user can open a page by selecting it through in the JList, or throught other mechanisms, like entering the number in a text box. When using the latter alternative, I want that the JList also selects the page. I do this using setSelectedIndex(), but this triggers an event, which causes the page to be loaded again, as if the user had clicked and selected the page in the JList, and this is causing me some problems. How I see it, the index should be set some way (perhaps in the model) so that only the

UIButton with UITableViewCellSelectionStyleGray Selection Color

↘锁芯ラ 提交于 2019-12-01 19:23:37
I am trying to set the selected color for a UIButton to the color of 'UITableViewCellSelectionStyleGray'; The problem is that the selection color of a UIButton cannot be set, only the image. Does anyone know how to make an image that is the exact color of a selected cell with UITableViewCellSelectionStyleGray? John Riselvato Unfortunately I can't seem to find the actual color programmatically but DigitalColor Meter (OSX APP) says the color is 217 217 217 UIColor* selectedColor = [UIColor colorWithRed:217.0/255.0 green:217.0/255.0 blue:217.0/255.0 alpha:1.0]; Try this: UIButton *button =

AST for current selected code in eclipse editor?

与世无争的帅哥 提交于 2019-12-01 18:26:17
I need to get the AST for the current selection in the java editor fo eclipse. Basically I want to convert the selected java code in to some other form(maybe some other language or XML etc..). So I guess, I need to get the AST for the selection. Currently I am able to get the selection as simple text. Is there any way out for such problem? Thanks already!! zvikico There are a number of handy tools for JDT plugin developers, especially the AST View which does pretty much what you are looking for. So, all you need to do is grab the code for AST View and check how it is done. The plugin can be

Android RecyclerView select first Item

流过昼夜 提交于 2019-12-01 18:05:51
I'm using a RecyclerView to implement a NavigationDrawer. I got click events working, but I can't figure out how to have the first item selected on App start and following that keep the selected item higlighted even if the drawer is not shown. All I've been able to find is multi-selection in RecyclerView. I actually just implemented this in an app I am working on. So this method worked: First create a variable to track the current selected position at the top of your adapter: private int selectedItem; Then in your Adapter constructor initiate the selectedItem value you would like: public

Extended selection mode, virtualization and IsSelected binding

ぐ巨炮叔叔 提交于 2019-12-01 16:57:34
It seems in extended selection mode IsSelected binding is buggy. Looks like only last item from selection which become out of scope is handled properly. Demonstration: Items 0 , 1 , 2 and 98 , 97 , 96 are selected with Control . When selecting 94 (without Control !) selection counter should be 1 , but you see 3 instead. Scrolling up reveals what only one (last) item of selection out of scope was unselected. Below is mcve: xaml: <ListBox ItemsSource="{Binding Items}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="

Save / restore selection on contentEditable AFTER modifying innerHTML

不羁岁月 提交于 2019-12-01 16:41:05
I know getting / setting cursor position in a contentEditable is damn near impossible. I don't care about knowing this information. I need to be able to save current selection, modify innerHTML of the div, and then restore the selection. I've bee experimenting with the answer provided at contenteditable selected text save and restore . It works after typing in the div, but not after programmatically modifying the innerHTML of the div. Instead, when I call restoreSelection, the caret simply goes to the beginning. Any suggestions as to how to be able to save / restore selection on a

Why can't the median-of-medians algorithm use block size 3?

眉间皱痕 提交于 2019-12-01 16:06:47
I am Working through the analysis of deterministic median finding under the assumption that the input is divided into 3 parts rather than 5 and the question is Where does it break down? the deterministic median finding algorithm: SELECT(i, n) Divide the n elements into groups of 5. Find the median of each 5-element group by rote. Recursively SELECT the median x of the ⎣n/5⎦ group medians to be the pivot. Partition around the pivot x. Let k = rank(x) 4.if i = k then return x elseif i < k then recursively SELECT the ith smallest element in the lower part else recursively SELECT the (i–k)th

css to remove text shadow on select / highlight text (mozilla)

白昼怎懂夜的黑 提交于 2019-12-01 15:13:41
I'm using text shadows for most text site wide, but when you highlight / select the text - the text looks fuzzy. So in order to remove the text shadow I use this css from here . ::-moz-selection, ::-webkit-selection, ::selection { text-shadow: none; background: #333; color: #fff; } The problem is that for some reason moz-selection doesn't seem to work (anymore?) in mozilla (Firefox). Here's the jsFiddle It seems like the problem was due to grouping multiple css rules (for the vendor specific css) together in conjuntion with the ::selection pseudo element. I originally thought that it was

How can I use jQuery to apply css to savedRange text selection?

心已入冬 提交于 2019-12-01 14:09:43
Is it possible to apply css or wrap tags around savedRange text selection. I'm using jquery. this doesn't work: $(savedRange).css(...); $(savedRange).wrap(...); Matt Zukowski If by "savedRange" you mean something like this: selection = window.getSelection() savedRange = selection.getRangeAt(0) Then you will have to create a wrapper for the range first, like so: wrapper = document.createElement('span') savedRange.surroundContents(wrapper) selection.selectAllChildren(wrapper) You can then apply style: $(wrapper).css(...) It won't work around selected text but this would put an HTML tag with some

css to remove text shadow on select / highlight text (mozilla)

﹥>﹥吖頭↗ 提交于 2019-12-01 14:05:34
问题 I'm using text shadows for most text site wide, but when you highlight / select the text - the text looks fuzzy. So in order to remove the text shadow I use this css from here. ::-moz-selection, ::-webkit-selection, ::selection { text-shadow: none; background: #333; color: #fff; } The problem is that for some reason moz-selection doesn't seem to work (anymore?) in mozilla (Firefox). Here's the jsFiddle 回答1: It seems like the problem was due to grouping multiple css rules (for the vendor