Re: [R] RGtk2: How to populate an GtkListStore data model?

From: Michael Lawrence <lawrence.michael_at_gene.com>
Date: Mon, 04 Apr 2011 06:33:07 -0700

On Sun, Apr 3, 2011 at 8:29 PM, Cleber N. Borges <klebyn_at_yahoo.com.br>wrote:

> hello all
> I am trying to learn how to use the RGtk2 package...
> so, my first problem is: I don't get the right way for populate my
> gtkListStore object!
> any help is welcome... because I am trying several day to mount the code...
> Thanks in advanced
> Cleber N. Borges
> ---------------------------
> # my testing code
>
> library(RGtk2)
> win <- gtkWindowNew()
> datamodel <- gtkListStoreNew('gchararray')
> treeview <- gtkTreeViewNew()
> renderer <- gtkCellRendererText()
> col_0 <- gtkTreeViewColumnNewWithAttributes(title="TitleXXX",
> cell=renderer, "text"="Bar")
> nc_next <- gtkTreeViewInsertColumn(object=treeview, column=col_0,
> position=0)
> gtkTreeViewSetModel( treeview, datamodel )
> win$add( treeview ) # is there an alternative function for this?
>
> # iter <- gtkTreeModelGetIterFirst( datamodel )[[2]]
> # this function don't give VALID iter
> # gtkListStoreIterIsValid( datamodel, iter ) result in FALSE
> iter <- gtkListStoreInsert( datamodel, position=0 )[[2]]
> gtkListStoreIterIsValid( datamodel, iter )
>
> # the help of this function say to terminated in -1 value
> # but -1 crash the R-pckage (or the gtk)...
>

Sorry about this. The help is autogenerated from the GTK+ C documentation.

> gtkListStoreSet(object=datamodel, iter=iter, 0, "textFoo")
> # don't make any difference in the window... :-(
>
>
>
It would be much easier to use rGtkDataFrame for populating this list. See the help for that function.

> ----
> R version 2.13.0 alpha (2011-03-27 r55091)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=Portuguese_Brazil.1252
> [2] LC_CTYPE=Portuguese_Brazil.1252
> [3] LC_MONETARY=Portuguese_Brazil.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=Portuguese_Brazil.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods
> [7] base
>
> other attached packages:
> [1] RGtk2_2.20.8
>
> loaded via a namespace (and not attached):
> [1] tools_2.13.0
> >
>
>
> my gtk version == 2.16.2
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 04 Apr 2011 - 13:35:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Apr 2011 - 14:00:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive