[Gtk-sharp-list] IconList help needed (or similar widget)
Paulo Pires
paulo.pires@vodafone.pt
Mon, 09 May 2005 22:19:41 +0100
--=-WmEG6dQPg3GfThwSfvX9
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi
I don't know if i've understood what u want correctly but what about a
TreeView, with something like the following code attached.
Then working with TreeSelection, and editing cells u can edit the info u
want. I hope to be helpful.
It is compiled with the following command: mcs -pkg:gtk-sharp
treeview_pix.cs
and ran with: mono treeview_pix.exe image_file
Paulo Pires
Ter, 2005-05-10 =E0s 01:03 +0800, Kevin Francis escreveu:
> I was previously advised to look elsewhere, that being to the flashy new
> IconView. However, it doesn't support editing the names of the files,
> which is exactly what I need, as I am writing an ftp client.
>=20
> Any suggestions on how to proceed?
>=20
> Cheers.
--=-WmEG6dQPg3GfThwSfvX9
Content-Disposition: attachment; filename=treeview_pix.cs
Content-Type: text/x-csharp; name=treeview_pix.cs; charset=us-ascii
Content-Transfer-Encoding: 7bit
using System;
using Gtk;
public class test : Window
{
public test (string image_file) : base ("test")
{
TreeView tree = new TreeView ();
TreeViewColumn col = new TreeViewColumn ();
col.Title = "bla";
CellRendererPixbuf cellpix = new CellRendererPixbuf ();
col.PackStart (cellpix, false);
col.AddAttribute(cellpix, "pixbuf", 0);
CellRendererText celltext = new CellRendererText ();
col.PackStart (celltext, true);
col.AddAttribute (celltext, "text", 1);
tree.AppendColumn (col);
TreeStore store = new TreeStore (typeof (Gdk.Pixbuf), typeof (string));
int counter = 0;
int max = 10;
while (counter < max)
{
store.AppendValues (new Gdk.Pixbuf (image_file), "Counter=" + counter.ToString ());
counter++;
}
tree.Model = store;
ScrolledWindow scroll = new ScrolledWindow ();
scroll.AddWithViewport (tree);
VBox v = new VBox ();
v.PackStart (scroll, true, true, 0);
this.Add (v);
this.HeightRequest = 400;
this.WidthRequest = 400;
this.DeleteEvent += OnWindowDeleteEvent;
this.ShowAll ();
}
public static void Main (string[] args)
{
Application.Init ();
if (args.Length < 1) { Console.Out.WriteLine ("\nYou must pass at least one argument!\nExiting...\n"); System.Environment.Exit (0);}
string image_file = args[0];
new test (image_file);
Application.Run ();
}
private void OnWindowDeleteEvent (object o, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
}
--=-WmEG6dQPg3GfThwSfvX9--