A text entry field with a dropdown list

Methods and Functions

gtkComboNew(show = TRUE) gtkComboSetPopdownStrings(object, strings) gtkComboSetValueInList(object, val, ok.if.empty) gtkComboSetUseArrows(object, val) gtkComboSetUseArrowsAlways(object, val) gtkComboSetCaseSensitive(object, val) gtkComboSetItemString(object, item, item.value) gtkComboDisableActivate(object) gtkCombo(show = TRUE)




GtkCombo implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Detailed Description

The GtkCombo widget consists of a single-line text entry field and a drop-down list. The drop-down list is displayed when the user clicks on a small arrow button to the right of the entry field. The drop-down list is a GtkList widget and can be accessed using the list member of the GtkCombo. List elements can contain arbitrary widgets, but if an element is not a plain label, then you must use the gtkListSetItemString() function. This sets the string which will be placed in the text entry field when the item is selected. By default, the user can step through the items in the list using the arrow (cursor) keys, though this behaviour can be turned off with gtkComboSetUseArrows. As of GTK+ 2.4, GtkCombo has been deprecated in favor of GtkComboBoxEntry. Creating a GtkCombo widget with simple text items.

# Creating a combobox with simple text items
###### items <- c("First Item", "Second Item", "Third Item", "Fourth Item",
           "Fifth Item")
combo <- gtkCombo()
Creating a GtkCombo widget with a complex item.
# Creating a combobox with a complex item
###### combo <- gtkCombo()
item <- gtkListItem() ## You can put almost anything into the GtkListItem widget. Here we will use
##   a horizontal box with an arrow and a label in it.
hbox <- gtkHbox(FALSE, 3)
item$add(hbox) arrow <- gtkArrow("right", "out")
hbox$packStart(arrow, FALSE, FALSE, 0) label <- gtkLabel("First Item")
hbox$packStart(label, FALSE, FALSE, 0) ## You must set the string to display in the entry field when the item is
##   selected.
combo$setItemString(item, "1st Item") ## Now we simply add the item to the combo's list.


Convenient Construction

gtkCombo is the equivalent of gtkComboNew.


allow-empty [logical : Read / Write]
Whether an empty value may be entered in this field. Default value: TRUE
case-sensitive [logical : Read / Write]
Whether list item matching is case sensitive. Default value: FALSE
enable-arrow-keys [logical : Read / Write]
Whether the arrow keys move through the list of items. Default value: TRUE
enable-arrows-always [logical : Read / Write]
Obsolete property, ignored. Default value: TRUE
value-in-list [logical : Read / Write]
Whether entered values must already be present in the list. Default value: FALSE


  • GtkCombo
  • gtkCombo
Documentation reproduced from package RGtk2, version 2.20.31, License: GPL

Community examples

Looks like there are no examples yet.