Hello! The IWigdets::combobox has an option "selectioncommand" to specify a procedure which is called when an item in the combobox is selected. Does ComboBox from Bwidgets have an equal option or is there a simple method to do thi? I haven't found one but i would like to use Bwidgets instead of Iwidgets. Another question which should not be a problem, but at the moment I just don't see the answer: How can I get the index of the selected item in an Iwidgets combobox? Till now I am only able to get the contents of the selected combobox item. Regards, Franco Mendolia
I think you want something like this:
require(tcltk) || stop("Package tcltk is not available.")
version.BWidget <- tclvalue(tclRequire("BWidget"))
modify_command <- function() {
print("Hey, I'm modified...")
}
tt <- tktoplevel()
values = c("foo", "bar", "jeebee")
combo <- tkwidget(tt, "ComboBox", "-modifycmd",
modify_command, values=values)
tkgrid(combo)
> How can I get the index of the selected item in an Iwidgets combobox? Till
now I
> am only able to get the contents of the selected combobox item.
For BWidget:
as.numeric(tclvalue(tcl(combo,"getvalue")))+1
I haven't used Iwdigets yet...
JeeBee.