selection

RichTextBox Save "Selection Direction"

Hi. I have a WinForms program where, whenever you change your selection, the RichTextBox needs to change the colour of certain other text. In order to do this, it has to select that text, and therefore I lose my current selection. I can save and load the SelectionStart and SelectionLength properties, but I can't keep the "selection dire...

Compare two datatables...

Hello.. i have two datatables with only one column each. i wanted to compare those two columns in two datatables. here is the example.. i am using C#.Net and WPF for achieving this. dt1 apple orange peach banana dt2 apple peach mango apricot now i want to compare dt2 with dt1. dt2 is bound to a list box. so once i match with dt1, th...

How to select a row or a cell in WPF DataGrid programmatically?

In WinForm DataGridView, it automatically selects the first row when initialized. It drove me crazy when I tried to turn that feature off. Moving to WPF DataGrid, it seems Microsoft has decided to turn this feature off, which is a good thing I think. However, I have hard time to enable this feature now. For some DataGrid, I want the firs...

Splitting Selection algorithm

Hi all. I got a problem of selecting triangles in a model with a particular way. The problem is simple enough : User have a model (made from triangles) , on that model define some margine line (cutting line if you wish), and after based on array of the verticies of the margin line I would like to select one part of the model or another...

Given a set of points to define a shape, how can I contract this shape like Photoshop's Selection>Contract

Hi All, I have a set of points to define a shape. These points are in order and essentially are my "selection". I want to be able to contract this selection by an arbitrary amount to get a smaller version of my original shape. In a basic example with a triangle, the points are simply moved along their normal which is defined by the p...

Strange behavior of selection

My JS code: function getSelectedText(){ if(window.getSelection){ select = window.getSelection().getRangeAt(0); var st_span = select.startContainer.parentNode.getAttribute("id").split("_")[1]; var end_span = select.endContainer.parentNode.getAttribute("id").split("_")[1]; ...

Javascript: get html around user selection?

It is possible to get whatever the user has selected with the mouse using Javascript, like this: http://www.motyar.info/2010/02/get-user-selected-text-with-jquery-and.html My issue is that I do not just need this text, but I also need: to get the html surrounding this text (eg. if the user selects "hello" and this hello is in the sour...

WPF DataGrid: How to clear selection programmatically?

It is a simple task in another grid, but I can't make it happen in WPF DataGrid. There are UnselectAll or UnselectAllCells methods, but don't work. Also, setting SelectedItem = null or SelectedIndex = -1 don't work either. There is a post here about completely disable selection, but that's not what I want. I just want to clear the curre...

Use jQuery to apply styling to all instances of clicked element

What I'm aiming for is for jQuery to look at the element I've just clicked on (for example a p or an li tag), then apply a styling to all instances of that element (so all p tags on the page). This is my code so far, but it only applies the styling to the single element that has been clicked on. $("article *", document.body).click(func...

Can i separate the selection model from an NSTableView

Is there any way how i can maintain my own data model of selected items in a NSTableView. I find it either pretty slow or complicated to keep the state of selected items when i update the table model. ...

Jquery - If cursor position at the start/end in a textfield

Hi, i have a textarea and I want to check if the cursor is at the start or at the end (I dont need the current position). Did anybody know a simple jQuery solution? Thanks in advance! Peter ...

How to only make one cell selectable

In my normal tableview I got a bunch of switches and segments, and I dont wont them to be selectable, so I set: tableView.allowsSelection = FALSE; Now one of the cells, I wont to point to a new view, and thereby make it selectable. But there's no cell.allowSelection or anything, how do I solve this. How do I make it, so that it can be...

QWebview/webkit disable selection of text

I have a QWebView which loads some webpage, but the problem when mouse is pressed and dragged it selectes everything which comes in its way. Is there any way I can get rid of this?? I dont want text and other items to be selected., If I restrict mouseMove and mousePress then it other functionality with these event also gets restricted ...

Prevent row selection in datagrid when clicking on a checkbox cell.

I have a DataGridView where each row has a checkbox in it. I only want the selected row to change when the user clicks on one of the text cells. However, if a checkbox is clicked I would still like to have the checkbox change its state and catch this event. I have searched everywhere and found a couple of solutions that fix half of th...

How to use jQuery prevAll() to select nearby text nodes?

I'm getting a text node (node.nodeType == 3) returned from the getSelection range, eg.: var selectionRange = selection.getRangeAt(0); var startContainer = selectionRange.startContainer; This startContainer usually is a text node, eg the following html: <p>Paragraph in <u>parag</u>raph.</p> Would result in the text node with text "r...

WPF ListView selection cannot be cleared on load?

I looked at several related answers, and determined that I can programmatically clear the selection by setting lstData.SelectedIndex = -1; However, when I do it right after setting the data context on startup, somehow it never works and gets set to select the first element in the list. I also tried adding the setting to the XAML, and -1...

Selection Sort - Stack Overflow

Hi I am trying to implement Selection Sort in vb.net using recursion. Problem is that I keep getting stackoverflow if the array I want to sort is 1000 elements. I can't find the problem. I don't know much about stack overflow or how to check it. From my research the problem could be infinite recursion but I check for that and exit the su...

Keep the selection in a textarea

Hi guys :) Can I prevent the loss of selection in the "onblur" event ? <!DOCTYPE html> <html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en"> <head> <meta http-equiv = "Content-Type" content = "text/html; charset=utf-8"> <script type = "text/javascript"> window.onload = function () {...

How to use the Android Intent.createChooser()?

I am trying to use the chooser so I don't have to create a selector-dialog. Maybe it is the wrong construct or widget to be using. What is happening is that the list of intents that I supply are inserted into a chooser dialog, but so are all the other applications on my device. Then if I use the back-button, the application "finishes....

removeAttr("selected") showing error in IE6

I have two listboxes set with multiple property and on adding the items from first to second, I don't want the selection on the second listbox. I wrote the code like this $("#<%=lbCommcatTo.ClientID%> option").removeAttr("selected"); It worked in IE7 but not in IE6. Can anyone please give me a solution? The html is <table cellspac...