[R-gui] Post hoc tweeking of ggenericwidget?

christiaan pauw cjpauw at gmail.com
Sat Dec 3 13:02:10 CET 2011


Thanks John

I have tried another approach after reading your advice. I followed
the example in the traitr vignette and included ggenericwidget inside
a traitr dialog together with a gvarbrowser object. Now you can drop
objects from the wordkspace browser (because in practice I always
froget or misspel something). All that is needed to implement this for
another function is varying the second last line.

regards
Christiaan

require(traitr)
options("guiToolkit"="RGtk2")

tt=stats:::t.test.default

d.dlg <- aDialog(items=list(),
title="generic dialog",
help_string="You're on your own here. Good night and good luck",
buttons=NULL
)

g=aGroup(attr=list(size=c(500,500)))
g2=aGroup()

g.view <- aGroup(
aContainer(
aFrame(aContainer(g2),label="Write var name or drop var for x")
),
aFrame(aContainer(g),label="Workspace Browser")
,horizontal=TRUE)
	
d.dlg$make_gui(gui_layout=g.view,visible=FALSE)

varbrowser <- gvarbrowser(cont=g$container)
tt.w <- ggenericwidget(tt,cont=g2$container)

d.dlg$visible(TRUE)


On 2 December 2011 22:55, j verzani <jverzani at gmail.com> wrote:
> christiaan pauw <cjpauw <at> gmail.com> writes:
>
>>
>> Hi Everybody
>>
>> ggenericwidet in the gWidgets package is really handy - you can get a
>> basic gui for your function in just about no time. Now I just want to
>> tweek it a little bit. For example: I want to use gvarbrowser to
>> select x . Can this type of object be manipulated after the initial
>> creation or must be all be done when it is created? If
>>
>
> The idea behind this widget is there are two steps: one to create
> a list specifying how to layout the dialog and the other to make the
> dialog. If you want to modify the object, you modify the list, not the
> dialog. The list can be obtained two ways. See either:
>
> cat(gWidgets:::autogenerategeneric(mean))
>
> or
>
> svalue(ggenericwidget(mean))
>
> The whole thing is pretty limited and you'll bump into its walls
> if you try too much, but it can make basic dialogs very simple.
> The gformlayout adds a bit more functionality for mapping a list
> into a dialog, but has nothing to autogenerate the list.
-- 
Christiaan Pauw
Nova Institute
www.nova.org.za



More information about the R-SIG-GUI mailing list