Cleber N. Borges
2011-Apr-04 03:29 UTC
[R] RGtk2: How to populate an GtkListStore data model?
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)... gtkListStoreSet(object=datamodel, iter=iter, 0, "textFoo") # don't make any difference in the window... :-( ---- 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
Michael Lawrence
2011-Apr-04 13:33 UTC
[R] RGtk2: How to populate an GtkListStore data model?
On Sun, Apr 3, 2011 at 8:29 PM, Cleber N. Borges <klebyn@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@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]]