Questions tagged [selection]

The selection can refer to text that has been highlighted, or it can refer to a choice made in UI elements that require one, e.g. a particular option in an HTML `select`. Selection is also the stage of a genetic algorithm in which individual genomes are chosen from a population for later breeding.

The selection can refer to:

  • a range of text that has been highlighted, a feature intended to mark the text for copying and, in editable areas, pasting over.

  • a choice made in UI elements that require one, e.g. a particular option in an HTML select. In UI elements, the selection is often made by means of drop-down boxes, radio buttons, checkboxes, file choosers, and more. Selections can be made with the mouse by clicking and dragging over the desired text, or by holding down the Shift key while navigating the text with the arrow keys. Selections are not usually permanent marks, and can often be removed just by clicking or selecting elsewhere.

  • the stage in genetic algorithms / programming is in which individual genomes are chosen from a population for later breeding (recombination or crossover).

4031 questions
31
votes
3 answers

How can I select by rows instead of individual cells in QTableView in PyQt?

In the sample code below (heavily influenced from here), I want the entire row of the clicked cell to be selected instead of the individual cell. How can I change the code to incorporate that? import re import operator import os import sys import…
c00kiemonster
  • 22,241
  • 34
  • 95
  • 133
30
votes
9 answers

Unselect all rows in datagridview

I have two datagridviews, and when I click to one of them, I would like to deselect all selection in the second datagridview, I tried this, but nothing works: firstItemsDataGridView.ClearSelection(); firstItemsDataGridView.CurrentCell = null; not…
Martin Ch
  • 1,337
  • 4
  • 21
  • 42
30
votes
5 answers

JavaScript: querySelector Null vs querySelector

What is the main difference between these two methods of referencing? What are the benefits of using one or the other? Also what kind of usage-case would they each be best suited to? var selection = document.querySelector('.selector') !==…
user3143218
  • 1,738
  • 5
  • 32
  • 48
29
votes
3 answers

Swapping text selections in Sublime Text 2

Forgive me if this has been asked before; I've looked around and while I can find (vague) documentation for swapping lines in Sublime Text, I can't see anything about swapping selections. For instance, say I have the following text:
j6m8
  • 2,261
  • 2
  • 26
  • 34
29
votes
7 answers

UICollectionView shouldSelectItemAtIndexPath=NO does not avoid deselecting old selection?

I have multiple items in a CollectionView, but only a few of them should be selectable. I'm handling this with the delegate method: - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath My…
sust86
  • 1,870
  • 2
  • 18
  • 25
28
votes
1 answer

Difference between range and selection in browser

I wanted to know the difference between the range and the selection object in JavaScript. It appears to me that you could get the same functionality out of either of these two. In which case are there are any specific circumstances where you know…
Gunner4Life
  • 736
  • 1
  • 8
  • 18
26
votes
1 answer

Select range in contenteditable div

I've got a contenteditable div and a few paragraphs in it. Here's my code:
angry kiwi
  • 10,730
  • 26
  • 115
  • 161
26
votes
3 answers

How do I select a single cell in a WPF datagrid?

When I click a cell in a WPF datagrid, the whole row is selected, and when I press Ctrl + C to copy the content, the whole row i copied... How do I select and copy the content of a single cell?
epsen
  • 263
  • 1
  • 3
  • 5
26
votes
1 answer

D3.js check to see if a node has a class

I'm trying to write a click function to select the next g.slice node, add a class of .sliceActive to it and remove .sliceActive from the original .slice. However, only when you are at the last g.slice (with a class of .slice5) you would add the…
NewToJS
  • 2,011
  • 4
  • 35
  • 62
26
votes
4 answers

Click and drag selection box in WPF

Is it possible to implement mouse click and drag selection box in WPF. Should it be done through simply drawing a rectangle, calculating coordinates of its points and evaluating position of other objects inside this box? Or are there some other…
rem
  • 16,745
  • 37
  • 112
  • 180
26
votes
9 answers

Styling the selection color of an input type=text, possible?

Having an input and doing this (using jQuery) $('#myTest').select(); causes "bla bla bla" to be selected with default dark blue selection color. Now, is there any way I can change this color…
Tommy
  • 283
  • 1
  • 4
  • 7
25
votes
3 answers

Append or prepend selected text to a file in Vim

In Vim, is there a way to move the selected text into .bak, appending or prepending? If possible, the backup file should not be displayed. I envision the workflow to be: Select some text Type :sbak The selection is saved into…
greatghoul
  • 1,448
  • 1
  • 17
  • 19
25
votes
1 answer

contenteditable div backspace and deleting text node problems

There are so many issues with contenteditable divs and deleting html and/or non content editable content inside editable divs. Using an answer by the excellent Tim Down here: How to delete an HTML element inside a div with attribute…
mstef
  • 1,164
  • 1
  • 13
  • 36
24
votes
8 answers

How to return the k-th element in TreeSet in Java?

Maybe I am not using the right data structure. I need to use a set, but also want to efficiently return the k-th smallest element. Can TreeSet in Java do this? There seems no built-in method of TreeSet to do this.
user1096734
24
votes
4 answers

JavaScript Set Window selection

In JavaScript, there is a method window.getSelection(), that lets me get the current selection that the user has made. Is there a corresponding function, something like window.setSelection(), that will let me set, or clear, the current selection?
Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201