On Mon, Nov 30, 2009 at 7:49 AM, j verzani <jverz...@gmail.com> wrote:

> jerry83 <chaohan1983 <at> yahoo.com> writes:
>
> Jerry, see below:
>
> >
> >
> > Hi John,
> >
> > Thanks A LOT for your reply and the code. What I want to do is to include
> the
> ggobi display window to the widget
> > window setup by me. I tried add before but it said can not do it for
> GGobiScatterplotDisplay. Do you have
> > any idea about add displays?
> >
> > Thanks again for your help.
> > Â
> >
> > ________________________________
> > From: jverzaniNWBKZ [via R] <ml-node+930927-1354988502 <at>
> n4.nabble.com>
> >
> > Sent: Sun, November 29, 2009 5:19:43 PM
> > Subject: Re: [R] how to put ggobi display into a GUI window setup by
> gWidgets
> >
> > jerry83 <chaohan1983 <at> yahoo.com> writes:
> >
> > >
> > >
> > > Hi,
> > >
> > > I want to put a ggobi display into a GUI window setup by gWidgets, but
> error
> > > occur said it is not a S4 object.
> > >
> > > Does anyone have any idea about how to put it in or maybe it can not be
> put
> > > into a widget at all?
> > >
> > > Thanks A LOT!
> >
> > To embed a GTK widget into gWidgets isn't too hard, just call the add
> method.
> > I'm not sure how  to get the GTK object you want from the ggobi
> > interface. Below is an example that you might be able to modify:
> >
> > ##
> > library(RGtk2)
> > library(rggobi)
> > library(gWidgets)
> > options(guiToolkit="RGtk2")
> >
> > ## ggoobi object
> > x <- ggobi(mtcars)
> >
> > ## grab child from main window. Modify (how?) to get
> > ## other widgets
> > toplevel <- ggobi_gtk_main_window(x)
> > child <- toplevel[[1]] Â # toplevel has only one child
> > toplevel$remove(child) Â # remove child if keeping toplevel
> > toplevel$destroy() Â  Â  Â # or destroy if not
> >
>
> ## add to a gWidget instance using gWidgetsRGtk2:
> > w <- gwindow("A gwidget's window")
> > g <- ggroup(cont = w, expand=TRUE)
> > add(g, child, expand=TRUE)
> >
> > --John
> >
>
>
> Here is some code to grab the display for a new display. I don't know
> how to get the initial display or even how to suppress it, but I'm
> not a ggobi user at this point.
>
> library(RGtk2)
> library(rggobi)
> library(gWidgets)
> options(guiToolkit="RGtk2")
>
> x <- ggobi(mtcars)
> ## not sure how to get the initial display,
> ## here we create a new display and move that
> disp <- display(x[1]) ## see display.GGobiData
>
>
Try

plotWidget <- display(x[1], embed=TRUE)

That will give you a display widget without hacking up the GGobi GUI.

## find table in the display heirarchy
> table <- disp[[2]]
>
> ## plot is third child (rulers are first two)
> plotWidget <- table[[3]]$getWidget()
> table$remove(plotWidget)
> ## hide window that held display. Destroy() causes errors
> disp$getParent()$hide()
>
> ## now we need to declass things so that gWidgets will
> ## recognize. The S3 classes from RGtk2 that gWidgets
> ## knows about are declared in package (should be
> ## dynamic, but aren't)
>
> class(plotWidget) <- class(plotWidget)[-(1:3)]
>
> w <- gwindow("A gwidget's window")
> g <- ggroup(cont = w, expand=TRUE)
> add(g, plotWidget, expand=TRUE)
>
>
>
> > ______________________________________________
> > [hidden email] 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.
> >
> > ________________________________
> >
> > View message @
> >
>
> http://n4.nabble.com/how-to-put-ggobi-display-into-a-GUI-window-setup-by-gWidgets-tp930529p930927.html
>
> > To unsubscribe from how to put ggobi display into a GUI window setup by
> gWidgets, click here.
> >
>
> ______________________________________________
> 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]]

______________________________________________
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.

Reply via email to