Greetings, im trying to show a simple plot-window in a GtkDrawingArea of a GTK3+ app. I thought it would be possible to use the CairoDevice-Package and hand the DrawingArea generated in my GTK-App via a DLL over to the CairoDeviceDriver, but I was unable to figure out, how. As far as I understand a call to the DLL via ".C" does not work, because a DrawingArea is not a basic C-Type. Using ".Call" (even for simple test calls without transferring parameters) always end up in a crash to RGUI. Registering my DLL-transfer-function (I'm not sure wether this is necessary or not) doesn't work either, because I lack the necessary lib-files to compile the register-function (I'm using VS2010). The entire project is based on VS2010 so using the RTools and gcc to build R from source to obtain the lib-files is no option. Any hints are greatly appreciated. kind regards, Thomas
[R-gui] embedding R in GTK+ (GtkDrawingArea)
4 messages · Thomas Glogowski, Michael Lawrence
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-gui/attachments/20130910/7b8bde0f/attachment.pl>
13 days later
Michael Lawrence <lawrence.michael <at> gene.com> writes:
The objects in RGtk2 (and cairoDevice) are externalptr objects in R. One
approach would be to create an externalptr in C, and then call some R code
that sets the class attribute accordingly, i.e., to the result of
gTypeGetAncestors("GtkDrawingArea"), and then calls asCairoDevice() on that
object.
Michael
Thank's Michael but I don't understand how to do what you've explained. How
can I change an external pointer (created in C) to be an
GtkDrawingArea using R?
What I've tried so far is:
-1-store the existing GtkDrawingArea* from my app in a DLL callable variable
-2-set up a DrawingArea in R with: DA <- gtkDrawingArea
-3-call the DLL-function with .Call ("R_Interface_get_da", DA )
-4-the DLL-function R_Interface_get_da takes DA as an SEXP and lets it point
to the variable created in step 1 (i.e. my apps DrawingArea).
Doing it that way I thought DA would be an object of the correct class
allready, because I only let it point to some other DrawingArea. But that
doesn't work in conjunction with asCairoDevice.
Thomas
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-gui/attachments/20130923/698d5174/attachment.pl>