selectedindex

How to implement Hold in Listbox?

放肆的年华 提交于 2019-12-03 21:10:27
问题 If hold the listbox, I want to get listbox index. This is my code: <ListBox Margin="0,0,-12,0" Hold="holdlistbox" x:Name="listbox" SelectionChanged="listbox_SelectionChanged" SelectedIndex="-1"> </ListBox> private void holdlistbox(object sender, System.Windows.Input.GestureEventArgs e) { //How to get ListBox index here } If anyone knows help me to do this. 回答1: e.OriginalSource will get you the actual control that was held (the top-most control directly under your finger). Depending on your

value of select elements with “e.value” vs “e.options[e.selectedIndex].value”

北城以北 提交于 2019-12-03 21:04:09
问题 Given the HTML: <select id="mySelect"> <option value="1">test1</option> <option value="2">test2</option> <option value="3">test3</option> </select> and the javascript: var e = document.getElementById('mySelect'); To get the value of the select I can use e.value and e.options[e.selectedIndex].value . I am aware that e.options[e.selectedIndex].value will give me the selected value (1,2 or 3) and e.options[e.selectedIndex].text would give me test1, test2, test3 depending on which is selected. Is

How to print index of selected option in Elm?

泪湿孤枕 提交于 2019-12-03 11:29:52
I have a <select> HTML element with 3 options and a <p> element. In the <p> element I want to print index of the currently selected item in <select> . E.g. if I select the first option, it should print 0, if I select the second option, it should print 1, and so on. How do I proceed from the minimal code, which is given below? import Html as H exposing (Html) import Maybe import Signal as S exposing (Address, (<~)) type alias Model = { selected : Maybe Int } model = { selected = Nothing } type Action = NoOp | Select Int update action model = case action of NoOp -> model Select n -> { model |

Items on ListBox show up as a class name

懵懂的女人 提交于 2019-12-01 06:12:56
The problem is as follows: I connected the ListBox with a list of elements of some custom class ( List<Person> persons = new List<Person>() ) using DataSource property. Of course ValueMember and DisplayMember are both assigned to appropriate properties of this class. When I first load data, everything looks ok. However, when I click on some item (i.e. 7th position, counting from 1) and then rebuild the list AND the number of elements is LESS than 7, as a result I can't see the proper texts on the list. Instead, every item shows up as a class name, preceded by the namespace. In other words,

value of select elements with “e.value” vs “e.options[e.selectedIndex].value”

こ雲淡風輕ζ 提交于 2019-11-30 22:52:41
Given the HTML: <select id="mySelect"> <option value="1">test1</option> <option value="2">test2</option> <option value="3">test3</option> </select> and the javascript: var e = document.getElementById('mySelect'); To get the value of the select I can use e.value and e.options[e.selectedIndex].value . I am aware that e.options[e.selectedIndex].value will give me the selected value (1,2 or 3) and e.options[e.selectedIndex].text would give me test1, test2, test3 depending on which is selected. Is it ok to use just e.value ? was this a problem in old browsers? which is more correct: e.value vs e

How to implement Hold in Listbox?

懵懂的女人 提交于 2019-11-30 22:05:45
If hold the listbox, I want to get listbox index. This is my code: <ListBox Margin="0,0,-12,0" Hold="holdlistbox" x:Name="listbox" SelectionChanged="listbox_SelectionChanged" SelectedIndex="-1"> </ListBox> private void holdlistbox(object sender, System.Windows.Input.GestureEventArgs e) { //How to get ListBox index here } If anyone knows help me to do this. e.OriginalSource will get you the actual control that was held (the top-most control directly under your finger). Depending on your ItemTemplate and where you hold then this could be any of the controls in the item. You can then check the

How to set selected index JComboBox by value

别说谁变了你拦得住时间么 提交于 2019-11-30 08:02:30
I want to set the selected index in a JComboBox by the value not the index. How to do that? Example public class ComboItem { private String value; private String label; public ComboItem(String value, String label) { this.value = value; this.label = label; } public String getValue() { return this.value; } public String getLabel() { return this.label; } @Override public String toString() { return label; } } JComboBox test = new JComboBox(); test.addItem(new ComboItem(0, "orange")); test.addItem(new ComboItem(1, "pear")); test.addItem(new ComboItem(2, "apple")); test.addItem(new ComboItem(3,

Why isn't 'SelectedIndex' defined on this ListView?

大憨熊 提交于 2019-11-29 15:59:56
I have created a ListView called listUsers , but for some reason SelectedIndex isn't defined. And I have set the MultiSelect to false. It also seems suspicious to me that "False" is bolded. Meaning that it was not default. This is not what I think I have been experiencing before. So I find this very strange, and I don't know how to fix it. I have tried so far (That didn't work): Restarted VS Copied a ListView from other forms, & pasted it on this form Deleted this.listUsers.MultiSelect definition from Designer's code And none worked. What is going on? Additional details: Windows 7 32-bit

retain dropdown selection on refresh [duplicate]

こ雲淡風輕ζ 提交于 2019-11-29 15:14:35
Possible Duplicate: retaining selected dropdown option on postback I have a dropdown when user selects the option, the value is passed on to the same url as querystring refreshing the page. after the page refreshes i wanna retain the selected value so user knows what was selected. How do i do this in jquery? <select id="hospitalDropDown" onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option value="http://mysite.com/events/Pages/default1.aspx">All Hospitals</option> <option value="http://mysite.com/events/Pages/default1.aspx?hos=Dyer">Dyer</option> <option value="http:/

How to set selected index JComboBox by value

落花浮王杯 提交于 2019-11-29 10:54:11
问题 I want to set the selected index in a JComboBox by the value not the index. How to do that? Example public class ComboItem { private String value; private String label; public ComboItem(String value, String label) { this.value = value; this.label = label; } public String getValue() { return this.value; } public String getLabel() { return this.label; } @Override public String toString() { return label; } } JComboBox test = new JComboBox(); test.addItem(new ComboItem(0, "orange")); test.addItem