[R] gtk, RGtk2 and error in callback: delet_event in mai window

Cleber N. Borges klebyn at yahoo.com.br
Sun Mar 27 18:25:01 CEST 2011


Hello All,

I am trying to learn about the GUI in R (with GTK+Glade+RGtk2) and in my 
test I don't get sucess in to make
an callback to destroy the application...

When I try to define an function for "delet-event callback", I get the 
error message:
(with mouse click in X window)

*Error in function ()  : *
*  unused argument(s) (<pointer: 0x017ca000>, <pointer: 0x017db218>)*

So, somebody has a tips for me?
Thanks in advanded

Cleber


 > ################################################
 > # make a file GLADE for testing...
 > tmp <- textConnection('
+ <?xml version="1.0"?>
+ <interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="window1">
+ <signal name="delete_event" handler="window1_delete_event"/>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </interface>
+ ')
 > glade_file <- readLines( tmp )
 > close( tmp ); rm( tmp )
 >
 > sink( file='glade_file.txt')
 > cat( glade_file )
 > sink()
 >
 > # call the binfings for GTK ( RGtk2_2.20.8 )
 > library(RGtk2)
*Warning message:*
*In inDL(x, as.logical(local), as.logical(now), ...) :*
*  DLL attempted to change FPU control word from 8001f to 9001f*
 >
 >
 > GUI <- gtkBuilderNew()
 > res <- gtkBuilderAddFromFile( GUI, filename='glade_file.txt' )
 > unlink( 'glade_file.txt' )
 >
 > # callback from delete_event ( small X in the Window )
 > window1_delete_event <- function() print('Work or dont work???')
 >
 > gtkBuilderConnectSignals( GUI )
 > window_main <- gtkBuilderGetObject( GUI, 'window1')
 > gtkWidgetShowAll( window_main )
 >
 > #####################################
 > #####################################
 > #####################################
 > # with the mouse, click in X window to close!!!!!!
 > #####################################
 > #####################################
 > #####################################
 >
*Error in function ()  : *
*  unused argument(s) (<pointer: 0x017ca000>, <pointer: 0x017db218>)*
 >
 > #########
 >
 > sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RGtk2_2.20.8
 >



More information about the R-help mailing list