зеркало из https://github.com/mono/mail-archives.git
146 строки
6.3 KiB
HTML
146 строки
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] R: NodeView/TreeView. Image and Text into the same column
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20R%3A%20NodeView/TreeView.%20Image%20and%20Text%20into%20the%0A%09same%20column&In-Reply-To=%21%26%21AAAAAAAAAAAYAAAAAAAAABLQ3kS4O51Irls0cMgyxgXCgAAAEAAAALTpHum79nNIre15ePRZ5MsBAAAAAA%3D%3D%40creasoftware.net">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="009698.html">
|
|
<LINK REL="Next" HREF="009704.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] R: NodeView/TreeView. Image and Text into the same column</H1>
|
|
<B>Andy Selvig</B>
|
|
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20R%3A%20NodeView/TreeView.%20Image%20and%20Text%20into%20the%0A%09same%20column&In-Reply-To=%21%26%21AAAAAAAAAAAYAAAAAAAAABLQ3kS4O51Irls0cMgyxgXCgAAAEAAAALTpHum79nNIre15ePRZ5MsBAAAAAA%3D%3D%40creasoftware.net"
|
|
TITLE="[Gtk-sharp-list] R: NodeView/TreeView. Image and Text into the same column">ajselvig at gmail.com
|
|
</A><BR>
|
|
<I>Fri Jun 19 02:34:23 EDT 2009</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="009698.html">[Gtk-sharp-list] NodeView/TreeView. Image and Text into the same column
|
|
</A></li>
|
|
<LI>Next message: <A HREF="009704.html">[Gtk-sharp-list] Gconf unsetting keys and walking the tree
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#9699">[ date ]</a>
|
|
<a href="thread.html#9699">[ thread ]</a>
|
|
<a href="subject.html#9699">[ subject ]</a>
|
|
<a href="author.html#9699">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Well, the easiest way is to declare your model as a TreeStore with two
|
|
strings (one for the name of the icon, one for the text):
|
|
|
|
var model = new Gtk.TreeStore(typeof(String), typeof(String));
|
|
|
|
The add rows with something like:
|
|
|
|
model.AppendValues(iconName, rowText);
|
|
|
|
Any icons that you show must be registered as a stock icon for this to work.
|
|
|
|
On Thu, Jun 18, 2009 at 6:57 PM, Aniello Di
|
|
Nardo<<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">dinardo at creasoftware.net</A>> wrote:
|
|
><i> Ok...
|
|
</I>><i>
|
|
</I>><i> But how to add a row or append values to the column?
|
|
</I>><i>
|
|
</I>><i> A.D.
|
|
</I>><i>
|
|
</I>><i> -----Messaggio originale-----
|
|
</I>><i> Da: Andy Selvig [mailto:<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">ajselvig at gmail.com</A>]
|
|
</I>><i> Inviato: venerdì 19 giugno 2009 1.38
|
|
</I>><i> A: Aniello Di Nardo
|
|
</I>><i> Cc: <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">gtk-sharp-list at lists.ximian.com</A>
|
|
</I>><i> Oggetto: Re: [Gtk-sharp-list] NodeView/TreeView. Image and Text into the
|
|
</I>><i> same column
|
|
</I>><i>
|
|
</I>><i> Instead of making two columns, you want to pack the image and text
|
|
</I>><i> into one column like this:
|
|
</I>><i>
|
|
</I>><i> Gtk.TreeViewColumn column = new Gtk.TreeViewColumn();
|
|
</I>><i> var iconRenderer = new Gtk.CellRendererPixbuf();
|
|
</I>><i> column.PackStart(iconRenderer, false);
|
|
</I>><i> column.AddAttribute(iconRenderer, "stock-id", 0);
|
|
</I>><i> var nameRenderer = new Gtk.CellRendererText();
|
|
</I>><i> column.PackStart(nameRenderer, true);
|
|
</I>><i> column.AddAttribute(nameRenderer, "text", 1);
|
|
</I>><i> treeView.AppendColumn(column);
|
|
</I>><i>
|
|
</I>><i> On Thu, Jun 18, 2009 at 6:38 PM, Aniello Di
|
|
</I>><i> Nardo<<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">dinardo at creasoftware.net</A>> wrote:
|
|
</I>>><i> Hi,
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i> I’ll pack an image and text into the same column of a NodeView/TreeView
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i> I’ve write the follow code, but it have two column… anyone can help me?
|
|
</I>>><i> Thanks
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i> Gtk.TreeStore tsItems = new Gtk.TreeStore (typeof (Gdk.Pixbuf), typeof
|
|
</I>>><i> (string));
|
|
</I>>><i>
|
|
</I>>><i> trwMain.AppendColumn ("Image", new Gtk.CellRendererPixbuf (), "pixbuf",
|
|
</I>><i> 0);
|
|
</I>>><i>
|
|
</I>>><i> trwMain.AppendColumn ("Text", new Gtk.CellRendererText (), "text", 1);
|
|
</I>>><i>
|
|
</I>>><i> trwMain.HeadersVisible = false;
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i> Gtk.TreeIter iter = tsItems.AppendValues
|
|
</I>>><i> (Gdk.Pixbuf.LoadFromResource("Tables.png"), "Tables");
|
|
</I>>><i>
|
|
</I>>><i> tsItems.AppendValues (iter, Gdk.Pixbuf.LoadFromResource("Names.png"),
|
|
</I>>><i> "Names");
|
|
</I>>><i>
|
|
</I>>><i> tsItems.AppendValues (iter, Gdk.Pixbuf.LoadFromResource("Jobs.png"),
|
|
</I>>><i> "Jobs");
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>>><i> trwMain.Model = tsItems;
|
|
</I>>><i>
|
|
</I>>><i> _______________________________________________
|
|
</I>>><i> Gtk-sharp-list maillist  -  <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
|
|
</I>>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
|
|
</I>>><i>
|
|
</I>>><i>
|
|
</I>><i>
|
|
</I>><i>
|
|
</I></PRE>
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="009698.html">[Gtk-sharp-list] NodeView/TreeView. Image and Text into the same column
|
|
</A></li>
|
|
<LI>Next message: <A HREF="009704.html">[Gtk-sharp-list] Gconf unsetting keys and walking the tree
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#9699">[ date ]</a>
|
|
<a href="thread.html#9699">[ thread ]</a>
|
|
<a href="subject.html#9699">[ subject ]</a>
|
|
<a href="author.html#9699">[ 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>
|