зеркало из https://github.com/mono/mail-archives.git
85 строки
2.8 KiB
HTML
85 строки
2.8 KiB
HTML
|
<!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:
|
||
|
><i> On Tue, 2004-04-06 at 00:18 -0400, Met wrote:
|
||
|
</I>><i> > >From a curser changed event, how do I get the selected row? I'd imagine
|
||
|
</I>><i> > I would get an index which would let me search through the
|
||
|
</I>><i> > TreeView.Model, but I cannot find examples, and the generated code is
|
||
|
</I>><i> > driving me crazy.
|
||
|
</I>><i> >
|
||
|
</I>><i> > Thanks in advance,
|
||
|
</I>><i> >
|
||
|
</I>><i> something like this:
|
||
|
</I>><i> TreeView tv = new TreeView ();
|
||
|
</I>><i> tv.Selection.Changed += new EventHandler (OnSelectionChanged);
|
||
|
</I>><i>
|
||
|
</I>><i> void OnSelectionChanged (object o, EventArgs args)
|
||
|
</I>><i> {
|
||
|
</I>><i> TreeModel model;
|
||
|
</I>><i> TreeIter iter;
|
||
|
</I>><i> string selected = "no selection";
|
||
|
</I>><i>
|
||
|
</I>><i> // you get the iter and the model if something is selected
|
||
|
</I>><i> if (tv.Selection.GetSelected (out model, out iter)
|
||
|
</I>><i> selected = (string) model.GetValue (iter, column);
|
||
|
</I>><i>
|
||
|
</I>><i> Console.WriteLine (selected);
|
||
|
</I>><i> }
|
||
|
</I>><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>
|