How to switch active device with gWidgets tabbed notebook? -


I have created a two-tab GUI with gWidgets. A graph is embedded in each of the two tabs. The problem is that Both articles are sent to tab 2. How can I switch or select an active device? A brief description of the Gwidgets package shows that in using handwriting or using ggraphicsnotebook Ggraphicsnotebook, some unwanted buttons are generated, so I'm thinking how to change it with an add-onler or other methods. A small example is attached thanks.

  # Library Library (Zid Wits); Library (Cairo device) option (GUIToolkit = "RGtk2") # First tab ---------------------------------- - ------------------------ R. Main & lt; - gwindow (title = "correlation", visible = TRUE) RNB & Lt; - gnotebook (container = r main) rsta & lt; - Group (container = RNB, horizontal = true, label = "static") RDN & LT; - Ggroup (container = RNB, horizontal = fault, label = "dynamic") Ggraphics (container = RSTA) obj.ptNum & lt; - gradio (item = C ("100", "1,000", "5,000"), selected = 2, horizontal = false, container = RSTA, handler = function (h.,) {Plot (1:10, main = "Static graph")}) # seconds tab ---------------------------- ----------- -------- obj.plotNum & lt; - gradio (items = C ("10", "50", "300", "400"), selected = 2, horizontal = TRUE, container = RDIN, handler = function (h, ...) {plot (30 : 35, Cole = 'red', main = "dynamic graph")}) GGFix (Container = RDIN)  

Edit: I found a solution Note that Problem tab Not about to choose, but the current active embedded device is about to choose. For future reference, my code has been copied down. A small problem is that I can not understand: when the application is started without clicking? Thanks all

  Library (Zid Wits); Library (cairoDevice); Library (GWDsRGTK2) Library (RGTK2) Option (GiatualKit = "RGTK2") # First tab ---------------------------- --- ---------------------------- R. Main & lt; - gwindow (title = "correlation", visual = TRUE) r.nb & lt; - gnotebook (container = R. maine) RSTA & lt; - ggroup (container = RNB, horizontal = true, label = "stable") ggraphics (container = RSTA) staPlot & lt; - Function (h, ...) {Sel & lt; - ifelse (test = length (dev.list ()) gt; = 2, yes = 2, not = 1) dev.set (joe = sel) plot (1: as.numeric (svalue (obj. PtNum), main = "Static graph")} obj.ptNum & lt;-gradio (item = C ("100", "150", "200"), selected = 2, horizontal = false, container = RSTA, handler = StaPlot) # Second tab -------------------------------------------- --- rDyn & Lt; - ggroup (container = RNB, horizontal = FALSE, label = "dynamic") dynPlot & lt; - function (h, ...) {SL <- ifelse (test = length ( Dev.set () =>, (=), ==, ==, = 3, not = 1) dev.set (joe = sel) plot (1: as.numeric (svalue (obj.plotNum)), col = 'red' Main = "dynamic graph")} obj.plotNum & lt; - gradio (item = C (" Ggraphics (container = RDIN) svalue (r.nb)  
/ Code>

It is bad to use Dev.set if you create a plot in a graphics device If you want, you can use the following code.

Articles & lt; - ggraphics ()

visible (graph) & lt; - TRUE

boxplot (...)


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -