selection

Firefox triple click selection returns incorrect start and end offsets

你离开我真会死。 提交于 2019-12-01 11:41:02
I have this piece of code which is supposed to return the start and end offsets of the user selection: <!DOCTYPE html> <html> <head> <script type="text/javascript"> function getSelRange() { var selObj = window.getSelection(); var range = selObj.getRangeAt(0); alert(range.startOffset+"-"+range.endOffset); } </script> </head> <body> <button onclick="getSelRange()">Get the selected text!</button> <p>Select some text!</p> </body> </html> When I select some text from the p by dragging, it alerts the numbers correctly. However, when I select the entire text in the p by triple clicking on it, it

How can I select multiple rows in UITableView

若如初见. 提交于 2019-12-01 10:48:19
I want to display some selected contacts in a list and then I need a feature to select multiple contacts at a time and then on clicking a button it should trigger an email to the selected contacts. For this I am using UITableView to display the contacts but I am not able to find any way to unable the multiple selection for UITableView. On doing some google search I found that UITableView does not support multiple selection. Is there any way to select multiple rows in UITableView or which control should I use for this purpose. Thanks in advance. Gaurav Check the Apple's Sample Code for this

Go to a item in Listview without using smoothScrollToPosition

核能气质少年 提交于 2019-12-01 10:32:26
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 animation which I don't want. What could I do ? Thanks. Try this out: myListView.post(new Runnable() {

Firefox triple click selection returns incorrect start and end offsets

好久不见. 提交于 2019-12-01 10:15:46
问题 I have this piece of code which is supposed to return the start and end offsets of the user selection: <!DOCTYPE html> <html> <head> <script type="text/javascript"> function getSelRange() { var selObj = window.getSelection(); var range = selObj.getRangeAt(0); alert(range.startOffset+"-"+range.endOffset); } </script> </head> <body> <button onclick="getSelRange()">Get the selected text!</button> <p>Select some text!</p> </body> </html> When I select some text from the p by dragging, it alerts

How can I select multiple rows in UITableView

雨燕双飞 提交于 2019-12-01 07:42:48
问题 I want to display some selected contacts in a list and then I need a feature to select multiple contacts at a time and then on clicking a button it should trigger an email to the selected contacts. For this I am using UITableView to display the contacts but I am not able to find any way to unable the multiple selection for UITableView. On doing some google search I found that UITableView does not support multiple selection. Is there any way to select multiple rows in UITableView or which

Get data from selected row of gtk treeview - gtkmm, c++

我怕爱的太早我们不能终老 提交于 2019-12-01 06:56:00
I have a GTK application that has a window with a treeview and a button. When the button is clicked I need to get the data from the first (and only) column of the selected row in the treeview . This is the class for the columns: class ModelColumns: public Gtk::TreeModel::ColumnRecord{ public: ModelColumns(){ add(m_port_name); } Gtk::TreeModelColumn<Glib::ustring> m_port_name; }; This is like in the example here but with only one column: http://www.lugod.org/presentations/gtkmm/treeview.html This is the button click signal handler at the moment: tvPorts is the treeview widget tvPortsList is the

Determining the selected InlineUIContainer in a WPF RichTextBox

我怕爱的太早我们不能终老 提交于 2019-12-01 06:18:13
I'd like to determine if there is an InlineUIContainer (or BlockUIContainer) at the current Caret position in a WPF RichTextBox. Currently I have a RichTextBox as follows; <RichTextBox SelectionChanged="RichTextBox_SelectionChanged"> <FlowDocument> <Paragraph> <Run>Some text before</Run> <InlineUIContainer> <Label>I am a label</Label> </InlineUIContainer> <Run>Some text after</Run> </Paragraph> </FlowDocument> </RichTextBox> In the SelectionChanged event I have tried using; rtf.CaretPosition.GetAdjacentElement(rtf.CaretPosition.LogicalDirection) ... which returns null. I can do it using the

ExtJS 4 - Grid - Disable rowselection for specific column

喜夏-厌秋 提交于 2019-12-01 05:51:54
I have created a grid with extjs 4. The selection.CheckboxModel is implemented to. This means that the row is selected/deselected wherever you click on the particular row. Now i want to disable this selection on the last column since it contains custom buttons. (I don't want to select the row if a button is clicked). Any idea's how to do this? Many thanks in advance! This is actually a tricky little problem, if only because Sencha documentation is lacking. The CheckboxModel does indeed have a beforeselect event inherited from Ext.selection.RowModel . However, there's no easy way to get the

Get data from selected row of gtk treeview - gtkmm, c++

耗尽温柔 提交于 2019-12-01 05:28:48
问题 I have a GTK application that has a window with a treeview and a button. When the button is clicked I need to get the data from the first (and only) column of the selected row in the treeview . This is the class for the columns: class ModelColumns: public Gtk::TreeModel::ColumnRecord{ public: ModelColumns(){ add(m_port_name); } Gtk::TreeModelColumn<Glib::ustring> m_port_name; }; This is like in the example here but with only one column: http://www.lugod.org/presentations/gtkmm/treeview.html

Replacing text inside textarea without focus

主宰稳场 提交于 2019-12-01 05:19:21
I want to replace selected text(or insert new text after cursor position if nothing is selected). The new text is entered from another textbox. I want to be able to insert new text without clicking first (focusing) in the textarea. meaning: first select text to replace inside textarea, then enter new text into the textbox and click the button. <textarea id='text' cols="40" rows="20"> </textarea> <div id="opt"> <input id="input" type="text" size="35"> <input type="button" onclick='pasteIntoInput(document.getElementById("input").value)' value="button"/> </div> function pasteIntoInput(text) { el