## make a simple item group, show in non-default layout
i <- anItemGroup(items=list(
numericItem(0,"x"),
numericItem(0,"y"),
stringItem("","z")
))
lay <- aContainer("x","y", aFrame("z", label="z in a box"))
## some proto methods:
i$make_gui(cont=gwindow("Example of itemGroup"), gui_layout=lay)
i$get_x() # get x value
i$set_x(10) # set x value to 10
i$to_R() # get list of x,y,z values
## example of using an item group and gbasicdialog to make a modal GUI
ig <- anItemGroup(items=list(
x=numericItem(2)
)
)
## using gbasicdialog from gWidgets
w <- gbasicdialog("testing", handler=function(h,...) {
. <- h$action # action passes in itemgroup
.$output <- sin(.$get_x())
},
action=ig)
ig$make_gui(container=w)
visible(w, TRUE) ## modal now
print(ig$output)
Run the code above in your browser using DataLab