listbox

Tkinter: Making a listbox that can change variables on selection

[亡魂溺海] 提交于 2020-01-16 19:01:09
问题 Now I made a procedure that activates on the click of a button. Now say I have a listbox called: selection = Tkinter.Listbox(b_action) selection.insert(1,"stuff") selection.insert(2,"morestuff") a = 0 How can I make that procedure run, each time I select a different part of the listbox? For example I first click "stuff" and then click "morestuff". Clicking "stuff" sets a to 1 and clicking "morestuff" sets a to 0 again. 回答1: You can create a dictionary mapping the actual listbox values with

Accessing child of ListBoxItem

我们两清 提交于 2020-01-16 17:59:45
问题 I have a ListBox with a DataTemplate that looks like this: <ListBox Name="listBox"> <ListBox.ItemTemplate> <DataTemplate DataType="x:Type local:NumericIconDefinition"> <Grid> <ComboBox Name="IconComboBox"/> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I would like to fetch the ComboBox instance in order to manipulate it in the code behind. I found a blog post that explained the process of fetching the ListBoxItem: ListBoxItem lbi = (ListBoxItem)listBox.ItemContainerGenerator

how to add text box in gtkmm:gtk::Listbox using c++

情到浓时终转凉″ 提交于 2020-01-16 01:05:12
问题 I want to add this type of text in Listbox using Gtkmm in c++. Can you suggest me any way how to do it, please? 回答1: For this very simple case, you might want to use gtkmm's ListViewText widget: https://developer.gnome.org/gtkmm/stable/classGtk_1_1ListViewText.html Here is some example code: https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/treeview/listviewtext/examplewindow.cc However, if you want to do anything more complex, you'd need to use the full Gtk::TreeView class.

transfer items from one listbox to another

僤鯓⒐⒋嵵緔 提交于 2020-01-15 23:44:07
问题 so far i have accomplished transfer a single select item from one lb1 to lb2 and vice versa. Now the problem is transfering the whole list of data from lb1 to lb2 and vice versa. if anyone could help please. using for loop will be much better. i am using the following code: private void add_Click(object sender, EventArgs e) { if (lb1.SelectedItem != null) { lb2.Items.Add(lb1.SelectedItem); lb1.Items.Remove(lb1.SelectedItem); } else { MessageBox.Show("No item selected"); } } private void

Getting a TreeViewItem from the Drop event in a TreeView when a different node is selected

ぃ、小莉子 提交于 2020-01-15 18:58:54
问题 I have a drag and drop from a ListBox into a TreeView, the problem I have is that I can only see the "IsSelected" node that is returned from the TreeView sender under the Drop event, this is because I am selecting a property from the listbox of a TreeViewItem and dragging it into another TreeViewItem. I hope that makes sense. I can't get the data from the "dropped" TreeViewItem, I currently have these methods but I can't get the TreeViewItem I drop the ListBoxItem into. private void nodeTree

Silverlight 4: Listbox doesn't shrink when its items shrink

為{幸葍}努か 提交于 2020-01-14 09:33:29
问题 from this question, I drilled down the problem to a listbox, that doesn't resize, when the Listbox-Items shrink. It resizes accordingly, when the size of the items grow, but it doesn't shrink, when the size of the items decrease. The items can grow/shrink because the items containing textboxes, that resize with the input. Jeremiah suggested to start a new question with more code to show, so here we go: Our evil listbox is part of a UserControl, that contains a StackPanel with a Label

How can I add items from a listbox to a list by clicking a button without any codebehind?

拈花ヽ惹草 提交于 2020-01-14 08:55:15
问题 I am new to MVVM, and also fairly new to WPF. As a matter of fact I started programming just a few months ago. MVVM is really dng my head in with the binding concept, and I have been trying for days now to just simply make an application that allows you to select an item from a listbx, and when you click on the add button the selected item should be saved in a new list. The second listbox displays the latest items added, and you can select an item and delete it by using another button.

mvvm binding selecteditem to update listview

喜你入骨 提交于 2020-01-14 05:13:08
问题 I'm new to MVVM and been trying to convert a working program to a MVVM program. I've been searching for an answer for this, but hadn't had any luck so far. Basicly what I have is this: A listbox and a listview. The listbox is filled with Trainstations and I want the times from the station in a listview (with delay etc). The listbox is filled with stations and I whenever I select a station, it gets updated and I have it in a variable called 'CurrentStation'. Now I'm using this 'CurrentStation'

Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource

微笑、不失礼 提交于 2020-01-14 04:30:08
问题 I'm trying to make 2 list boxes where I can press on a button to add an item selected from the left listbox to the right listbox. Here's the XAML for the listboxes: <ListBox x:Name="LeftList" Foreground="{StaticResource Foreground}" HorizontalAlignment="Left" Height="237" Margin="15,103,0,0" VerticalAlignment="Top" Width="128"> <ListBoxItem>360T</ListBoxItem> <ListBoxItem>BARX</ListBoxItem> <ListBoxItem>BNP</ListBoxItem> <ListBoxItem>BOA</ListBoxItem> <ListBoxItem>CITI</ListBoxItem>

WPF: ListBox unselecting

a 夏天 提交于 2020-01-14 03:27:10
问题 When the user clicks on a item in my single-select ListBox , the item is selected. When the user clicks on a item the second time, the item is not unselected unless they are holding the control key. What is the recommended way to change #2 to not require the control key? 回答1: Make sure the selection mode is Multiple . By selecting multiple: you can use the mouse to select and deselect any item(s) you want with just a mouseclick. But if you want only 1 selected item at a time, you'll have to