[Gtk-sharp-list] How to display data from a SQLite database into a GTK# TreeView?

NPcomplete kzvezdarov at gmail.com
Sat Apr 30 11:03:46 EDT 2011


Hi,

Thanks this was really nice! I had reached the conclusion that I need to
write my own version of the tree  model, but you just saved me a lot of
work, I really appreciate it.
As far as the other error, I found out the problem (I think): the cell
renderer reference when creating the column and when adding a cell to
display data must be the same. Interestingly enough, it worked if I used one
object reference for all the cells throughout the table. I guess I just need
to read more into the GTK+ documentation.

Thank you again.

Kiril.

2011/4/29 Christian Hoff [via Mono] <
ml-node+3483937-1295176258-233715 at n4.nabble.com>

> Hey,
>
> > http://www.mono-project.com/GtkSharp_TreeView_Tutorial. First I create
> the
> > model (ListStore) by initializing it with the string type for the data of
>
> > every column. Then I append the columns of the data table to the tree
> > view.
> > Then I engage the sqlite reader, and for every entry I add its data to
> the
> > model. Then I add a cell for each column pointing to the data. Finally, I
>
> > give the tree view its model.
>
> The clean way would be to create your own TreeModel for the kind of data
> you are trying to read.
>
> I have written a model for Sytem.Data.DataViews and generalized to it to
> take any type of list some time ago, and these are sufficient probably for
> most of all queries.
>
> Using your own TreeModel causes a significant performance boost compared to
> copying the data in the beginning and is a more clean approach to the
> problem.
>
> Simply use treeModel = new Gtk.TreeModelAdapter(new
> IListStore(mydataview)));
> to make it work.
>
> Maybe some day we can get this integrated into Gtk# trunk. I still think
> that IList support would be a valueable addition, but unfortunately I did
> not have the time to pursue this further.
>
> You might also want to look at gtk-databind at
> http://gtk-databind.arsis.net/, but the project seems to be dead.
>
> Unfortunately, I cannot help you with the specific error you are seeing
> with your code.
>
> - Christian
> --
> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
>
> _______________________________________________
> Gtk-sharp-list maillist  -  [hidden email]<http://user/SendEmail.jtp?type=node&node=3483937&i=0&by-user=t>
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
> *IListStore.cs* (12K) Download Attachment<http://attachment/3483937/0/IListStore.cs?by-user=t>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://mono.1490590.n4.nabble.com/How-to-display-data-from-a-SQLite-database-into-a-GTK-TreeView-tp3482522p3483937.html
>  To unsubscribe from How to display data from a SQLite database into a GTK#
> TreeView?, click here<http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3482522&code=a3p2ZXpkYXJvdkBnbWFpbC5jb218MzQ4MjUyMnwtMTgyOTQwNDA1>.
>
>
--
View this message in context: http://mono.1490590.n4.nabble.com/How-to-display-data-from-a-SQLite-database-into-a-GTK-TreeView-tp3482522p3486030.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20110430/407a0293/attachment.html 


More information about the Gtk-sharp-list mailing list