[Gtk-sharp-list] cellrendererprogress confusion

clarence clarence catchfire at gmail.com
Wed Feb 18 00:27:24 EST 2009


I guess i should be a bit more specific than my initial hand wavy post....

So at the moment i have a...
  Dictionary<int, thing> thingDictionary = new Dictionary<int, thing>();

to that i have added a new object of type 'thing" (the 'thing' object
generates a number from 1 to 100 every second)....
  thingDictionary.Add(new thing());

i create my ListStore etc....
  Gtk.ListStore store = new Gtk.ListStore(typeof(thing));
  treeview1.AppendColumn("gear", new Gtk.CellRendererProgress(),new
TreeCellDataFunc(renderit));
  store.AppendValues(thingDictionary);
  treeview1.Model = store;

The error I am getting is a "Cannot cast from source type to destination
type" at the line indicated.....

public void renderit(Gtk.TreeViewColumn col, Gtk.CellRenderer cell,
Gtk.TreeModel model, Gtk.TreeIter iter)
    {
Error Here -> thing tt = (thing) model.GetValue(iter,0);
        (cell as Gtk.CellRendererProgress).Value = tt.time;
    }

Hope that is not too confusing ;)

Cheers
Gary A

On Wed, Feb 18, 2009 at 1:22 PM, clarence clarence <catchfire at gmail.com>wrote:

> hello.
>
> i am currently trying to figure out how to make the treecelldatafunc
> work for a cellrendererprogress.. i am learning gtk-sharp by writing
> my own gui download mananger which at the moment is working really
> well except for the cellrendererprogress.
>
> all i am really needing is an explanation or simple example to explain
> how it actually works.
>
> i have been looking around at the code for galxium, monsoon, banshee
> and the mono torrent library (torrentsharpi think it is called?) but
> for the life of me cannot figure out how it actually works..
>
> much appreciated
> Gary A
>
> --
> __________
> wow
>



-- 
__________
wow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20090218/6d0c0262/attachment.html 


More information about the Gtk-sharp-list mailing list