[Gtk-sharp-list] Dynamic from SQLite popuplated Treeview mad editable

Sebastian exit at are-you-ready.de
Mon Aug 30 02:37:16 EDT 2010


Am Freitag, den 27.08.2010, 20:59 +0200 schrieb Rampage:
> Sebastian ha scritto:
> > Am Donnerstag, den 26.08.2010, 07:01 -0700 schrieb Rampage:
> >   
> >>     
> >>> Yes that is what I wanted to do. The Problem with this is that I don´t
> >>> have the columname in the edited method or I don´t know how to get it.
> >>> As I can see ther is no args Property that gives me the columname, only
> >>> Rownumvers and the edited Text.
> >>>
> >>>
> >>>       
> >> Probably i'm dumb but i don't understand this.
> >>
> >> you are populating a treeview by using a sqlite database, so basically you
> >> do select statements to populate the treeview.
> >>
> >> if you have a table in your sqliteDB that is something (for example) like
> >>
> >> DVD(id, title, year, lenght, ....)
> >>
> >> and you want to edit a movie that is like
> >>
> >> DVD(1, "toy story 3", 2010, 120, ....)
> >>
> >> and you want to edit the title you can do
> >>
> >> int movieid = (int)((TreeView)obj_sender).Model.GetValue(argv.Iter, 0) //
> >> you obtain the id of the movie you are editing
> >>
> >> and then you perform your query
> >> UPDATE DVD SET lenght="90" WHERE id=movieid
> >>     
> >
> > I tried this but the problem is that the argv doesn't has a .Iter
> > method. For args the only things you can call are "Args", "NewTex",
> > "Path" and "RetVal". With that you are able to get the new Value and the
> > Rownumber but you still don't know where to put this becaus the Column
> > is missing. The Object on the other Hand shows me in Debug Mode that it
> > Holds a Value "Text" in which the original Cellentry is held. With that
> > Value I could start an SQL Query and replace it with the new one but
> > unfortunatly I can't find a Method to get that Value.
> >
> >   
> I think you can forcefully set the iter from the path like this
> 
> protected virtual void TestMethod(object sender, Gtk.EditedArgs args)
> {
>     TreeIter iter = new TreeIter();
>     ((TreeView)sender).model.GetIter(iter, args.Path);
> }
> 
> i dunno tho
> 
> Francesco

With that I get an error that there is no method "model"
Here is the snippet:

static void CellEdit (object o, Gtk.EditedArgs args)
	{
		TreeIter iter;
		TreePath path = new TreePath(args.Path);
		store.GetIter(out iter, path);
		//store.SetValue(iter, 0, args.NewText);
		string storestring = store.NColumns.ToString();
		Console.WriteLine(storestring);
		string iterstring = iter.ToString();
--------------------------------------------------------------------------		
When I debug there I can see that path holds the rownumber an NColumns
holds the total count of all columns available not the specific one
where I made the changes.



More information about the Gtk-sharp-list mailing list