4

I am creating an interface that allows users to edit a data frame, which will then be used as an input for the script. The choices the user can input into each cell is limited. Thus, I am wondering if there is a way to implement a gdroplist (with each column having a different a different items) to each cell in gdf?

Regards,

Wet Feet

Wet Feet
  • 4,435
  • 10
  • 28
  • 41

2 Answers2

4

in gWidgets2RGtk2 the editor in gdf for factors is a combobox where the items to choose from are the levels of the factor. If that works for you great, otherwise you can dust off your RGtk2 skills. (The basic cell editor code is here.)

jverzani
  • 5,600
  • 2
  • 21
  • 17
  • Do you know how to turn on the combobox? I ran the following code but the combobox didn't come up. `gdf(data.frame(x=factor(c(1,2,3,4,5,6,2,3,4,5))),cont=TRUE)` EDIT:Wait a minute, I noticed you are using gwidgets2. Let me try downloading that. – Wet Feet Jan 13 '14 at 09:03
1

This pdf has an example that might be helpful. See the details on page 12.

Page 13 of this pdf discusses adding a handler to the single and double click actions. Perhaps you could insert the gdroplist to one of the handlers.

handler = function(h,...) {
print(do.call(h$action, list(get(svalue(h$obj)))))
})

Possibly helpful:

Community
  • 1
  • 1
JSuar
  • 21,056
  • 4
  • 39
  • 83