mail-archives/gtk-sharp-list/2006-April/007089.html

93 строки
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Drop-down list
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Drop-down%20list&In-Reply-To=69dead7b0604130346v2af883dfs57844d95e1798476%40mail.gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007087.html">
<LINK REL="Next" HREF="007090.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Drop-down list</H1>
<B>Finn Gruwier Larsen</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Drop-down%20list&In-Reply-To=69dead7b0604130346v2af883dfs57844d95e1798476%40mail.gmail.com"
TITLE="[Gtk-sharp-list] Drop-down list">finn at gruwier.dk
</A><BR>
<I>Thu Apr 13 08:57:38 EDT 2006</I>
<P><UL>
<LI>Previous message: <A HREF="007087.html">[Gtk-sharp-list] A Searchable ComboBox
</A></li>
<LI>Next message: <A HREF="007090.html">[Gtk-sharp-list] Drop-down list
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7089">[ date ]</a>
<a href="thread.html#7089">[ thread ]</a>
<a href="subject.html#7089">[ subject ]</a>
<a href="author.html#7089">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Chris Wilson skrev:
&gt;<i> You probably want attach a ListStore to the ComboBox' Model. The gives
</I>&gt;<i> you a way to attach a list store with 2 columns to the ComboBox: one
</I>&gt;<i> for an index into your ArrayList and the other to display. You can
</I>&gt;<i> then get the active row and use the index column in the ListView to
</I>&gt;<i> get into the Array.
</I>&gt;<i>
</I>&gt;<i> Take a look at the tutorial for using the TreeView at:
</I>&gt;<i> <A HREF="http://www.mono-project.com/GtkSharp_TreeView_Tutorial">http://www.mono-project.com/GtkSharp_TreeView_Tutorial</A>
</I>&gt;<i>
</I>&gt;<i> It will show you how to setup a ListStore (The one-dimension version
</I>&gt;<i> of the TreeStore).
</I>&gt;<i>
</I>&gt;<i> Hope that point you in the right direction.
</I>
I think I'm beginning to get it.
I have this:
//I need objects of class Address, so I make a ListStore
// with two &quot;columns&quot;: one containing the text, one containg the object
ListStore ls = new ListStore(typeof(string), typeof(Address));
//I need to fetch the objects from the ArrayList currentUnit.Addresses
foreach(Address a in currentUnit.Addresses)
{
ls.AppendValues(a.ToString(), a);
}
The problem now is that the combo does not display anything. I think
what I need now a way to &quot;tell&quot; the combo that the values to display are
in the first &quot;column&quot;.
Regards,
Finn Gruwier Larsen
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007087.html">[Gtk-sharp-list] A Searchable ComboBox
</A></li>
<LI>Next message: <A HREF="007090.html">[Gtk-sharp-list] Drop-down list
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7089">[ date ]</a>
<a href="thread.html#7089">[ thread ]</a>
<a href="subject.html#7089">[ subject ]</a>
<a href="author.html#7089">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>