gcombobox {gWidgets2} | R Documentation

## constructor for a combobox

### Description

A combobox can be either a drop down list (editable=FALSE), or a drop-down list and edit area (a combobox).

generic for toolkit dispatch

Alias for gcombobox. Deprecated

Non exported helper function to coerce items into a data frame. First column contains the values, second stock icons, third tooltips

Ensure that value is a data frame. One can pass a vector or a one-column data frame to inidicate the possible values for selection, a second column is used for an icons (if possible), a third for a tooltip (if possible).

Change handler for a non-editabe combobox is called when a new value is selected. For editable comboboxes, the handler is also called when the text entry box is activated.

The `svalue` method for a combobox object refers to its main property, the selected value. When `index=FALSE` (or `NULL`) the value is returned. If `index=TRUE` the index of the object within the set of items is used.

### Usage

    gcombobox(items, selected = 1, editable = FALSE, coerce.with = NULL,
      handler = NULL, action = NULL, container = NULL, ...,
      toolkit = guiToolkit())

    .gcombobox(toolkit, items, selected = 1, editable = FALSE,
      coerce.with = NULL, handler = NULL, action = NULL, container = NULL,
      ...)

    gdroplist(...)

    .make_gcombobox_items(value)

    ## S3 replacement method for class 'GComboBox'
     x[i , j, ...] <- value

    ## S3 method for class 'GComboBox'
    addHandlerChanged(obj, handler, action = NULL, ...)

    ## S3 method for class 'GComboBox'
    svalue(obj, index = NULL, drop = NULL, ...)

### Arguments

`items` | Items to select from. A vector or a data frame. If a data frame, then first column is values. Second is optional, but can specify a stock icon name, third is optional and can be used to specify a tooltip. These may not be supported in all toolkits.
`selected` | integer. Which item (by index) is selected. Use -1 for no selection
`editable` | logical. Is user allowed to edit value
`coerce.with` | A function of function name to be called before selected value is returned by `svalue`
`handler` | Called when combobox value is changed.
`action` | passed to handler
`container` | parent container
`...` | passed to parent container's `add` method
`toolkit` | toolkit
`value` | new items for selection
`x` | combobox object
`i` | item index
`j` | ignored
`obj` | object receiving event and emitting a signal to the handler
`index` | NULL or logical. If `TRUE` and widget supports it an index, instead of a value will be returned.
`drop` | NULL or logical. If widget supports it, drop will work as it does in a data frame or perhaps someother means.

### Value

Returns an object of class `GComboBox` for which the following methods are overriden:

1. `svalue` Return selected value by name or (if `index=TRUE` by index). The latter only if `editable=FALSE`.

2. `svalue<-` Set the selected value by value or if `index=TRUE` by index.

3. `[` return items to select from

4. `[<-` Set items to select from.

[Package gWidgets2 version 1.0-8 Index]