mail-archives/gtk-sharp-list/2005-June/006042.html

109 строки
3.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Fwd: [Gtk-sharp-list] ComboBox AppendText and Active]
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BFwd%3A%20%5BGtk-sharp-list%5D%20ComboBox%20AppendText%20and%20Active%5D&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="006057.html">
<LINK REL="Next" HREF="006058.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Fwd: [Gtk-sharp-list] ComboBox AppendText and Active]</H1>
<B>Daniel Morgan</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BFwd%3A%20%5BGtk-sharp-list%5D%20ComboBox%20AppendText%20and%20Active%5D&In-Reply-To="
TITLE="[Fwd: [Gtk-sharp-list] ComboBox AppendText and Active]">danielmorgan at verizon.net
</A><BR>
<I>Sat Jun 25 20:34:44 EDT 2005</I>
<P><UL>
<LI>Previous message: <A HREF="006057.html">[Gtk-sharp-list] ComboBox AppendText and Active
</A></li>
<LI>Next message: <A HREF="006058.html">[Fwd: [Gtk-sharp-list] ComboBox AppendText and Active]
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6042">[ date ]</a>
<a href="thread.html#6042">[ thread ]</a>
<a href="subject.html#6042">[ subject ]</a>
<a href="author.html#6042">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Here is a customization we could use:
public int SetActiveText (string text)
{
// returns index that was set; otherwise -1 if it could not
int comboIndex = 0;
string tvalue;
TreeIter iter;
combo.Model.IterChildren (out iter);
tvalue = combo.Model.GetValue (iter, 0).ToString();
if (tvalue.Equals (text)) {
combo.Active = comboIndex;
return comboIndex;
}
else {
bool found = combo.Model.IterNext (ref iter);
while (found == true) {
comboIndex ++;
tvalue = combo.Model.GetValue (iter, 0).ToString();
if (tvalue.Equals (text)) {
combo.Active = comboIndex;
return comboIndex;
}
else
found = combo.Model.IterNext (ref iter);
}
}
return -1; // not found
}
-------------- next part --------------
An embedded message was scrubbed...
From: Daniel Morgan &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">danielmorgan at verizon.net</A>&gt;
Subject: [Gtk-sharp-list] ComboBox AppendText and Active
Date: Sat, 25 Jun 2005 19:59:59 -0400
Size: 3797
Url: <A HREF="http://galactus.ximian.com/pipermail/gtk-sharp-list/attachments/20050625/cd4deae0/Gtk-sharp-listComboBoxAppendTextandActive.mht">http://galactus.ximian.com/pipermail/gtk-sharp-list/attachments/20050625/cd4deae0/Gtk-sharp-listComboBoxAppendTextandActive.mht</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="006057.html">[Gtk-sharp-list] ComboBox AppendText and Active
</A></li>
<LI>Next message: <A HREF="006058.html">[Fwd: [Gtk-sharp-list] ComboBox AppendText and Active]
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6042">[ date ]</a>
<a href="thread.html#6042">[ thread ]</a>
<a href="subject.html#6042">[ subject ]</a>
<a href="author.html#6042">[ 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>