1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
w <- gwindow("combobox example", visible=FALSE)
g <- ggroup(cont=w, horizontal = FALSE)
m = data.frame(labels = letters[1:3],
icons = c("quit","open","file"),
tips = paste("the letter", letters[1:3])
)
## vector argument
cb1 = gcombobox(m[,1, drop=TRUE], selected=1, cont =g)
# svalue
print(svalue(cb1))
print(svalue(cb1, index=TRUE))
#savlue<-
svalue(cb1) <- "b"
svalue(cb1, index=TRUE) <- 3
# [
print(cb1[])
# [<-
cb1[] <- toupper(letters[1:3])
## handler
addHandlerChanged(cb1, handler = function(h,...) print(svalue(h$obj)))
##### Width
cb1.5 <- gcombobox(m, width=100, cont = g)
##### editable
cb2 <- gcombobox(m[,1,drop=TRUE], editable = TRUE, cont = g)
## svalue<-
svalue(cb2) <- "editable"
## svalue
print(svalue(cb2))
## icons? toolkit specific, but should handle this gracefully
cb3 <- gcombobox(m, cont = g)
visible(w) <- TRUE
|