mail-archives/gtk-sharp-list/2004-April/003782.html

85 строки
2.8 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:02:55 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] TreeView Selection
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:met%40uberstats.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="003781.html">
<LINK REL="Next" HREF="003776.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] TreeView Selection
</H1>
<B>Met
</B>
<A HREF="mailto:met%40uberstats.com"
TITLE="[Gtk-sharp-list] TreeView Selection">met@uberstats.com
</A><BR>
<I>Wed, 07 Apr 2004 00:20:41 -0400</I>
<P><UL>
<LI> Previous message: <A HREF="003781.html">[Gtk-sharp-list] TreeView Selection
</A></li>
<LI> Next message: <A HREF="003776.html">[Gtk-sharp-list] System.Drawing Gdk binding
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3782">[ date ]</a>
<a href="thread.html#3782">[ thread ]</a>
<a href="subject.html#3782">[ subject ]</a>
<a href="author.html#3782">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hello,
On Wed, 2004-04-07 at 00:10, John Luke wrote:
&gt;<i> On Tue, 2004-04-06 at 00:18 -0400, Met wrote:
</I>&gt;<i> &gt; &gt;From a curser changed event, how do I get the selected row? I'd imagine
</I>&gt;<i> &gt; I would get an index which would let me search through the
</I>&gt;<i> &gt; TreeView.Model, but I cannot find examples, and the generated code is
</I>&gt;<i> &gt; driving me crazy.
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; Thanks in advance,
</I>&gt;<i> &gt;
</I>&gt;<i> something like this:
</I>&gt;<i> TreeView tv = new TreeView ();
</I>&gt;<i> tv.Selection.Changed += new EventHandler (OnSelectionChanged);
</I>&gt;<i>
</I>&gt;<i> void OnSelectionChanged (object o, EventArgs args)
</I>&gt;<i> {
</I>&gt;<i> TreeModel model;
</I>&gt;<i> TreeIter iter;
</I>&gt;<i> string selected = &quot;no selection&quot;;
</I>&gt;<i>
</I>&gt;<i> // you get the iter and the model if something is selected
</I>&gt;<i> if (tv.Selection.GetSelected (out model, out iter)
</I>&gt;<i> selected = (string) model.GetValue (iter, column);
</I>&gt;<i>
</I>&gt;<i> Console.WriteLine (selected);
</I>&gt;<i> }
</I>&gt;<i>
</I>
Perfect, thanks a lot.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="003781.html">[Gtk-sharp-list] TreeView Selection
</A></li>
<LI> Next message: <A HREF="003776.html">[Gtk-sharp-list] System.Drawing Gdk binding
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3782">[ date ]</a>
<a href="thread.html#3782">[ thread ]</a>
<a href="subject.html#3782">[ subject ]</a>
<a href="author.html#3782">[ author ]</a>
</LI>
</UL>
</body></html>