gradio               package:gWidgets               R Documentation

_W_i_d_g_e_t_s _t_o _a_l_l_o_w _s_e_l_e_c_t_i_o_n _f_r_o_m _a _v_e_c_t_o_r _o_f _i_t_e_m_s

_D_e_s_c_r_i_p_t_i_o_n:

     Widgets to select one (or several) from a given vector of items.
     These are a radio group where all values are shown at once, but
     only one may be selected; a checkbox group where more than one may
     be selected; and a droplist where initially only a single value is
     shown, and the others are a mouse click away,

_U_s_a_g_e:

     gradio(items, selected = 1, horizontal = FALSE, handler
     = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())

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

     gcheckboxgroup(items, checked = FALSE,  horizontal = FALSE, 
         handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit()) 

_A_r_g_u_m_e_n_t_s:

   items: Vector of values to select from 

selected: For gradio the initial selected value (as an index) For a
          drop list, the first selected value. Use 0 to leave blank

 checked: For gcheckboxgroup a logical vector of initial values.

editable: For gdroplist, a logical indicating if the user can add an
          entry to the list of available answers

coerce.with: Apply this function to selected value before returning

horizontal: A logical specifying the  layout for gradio and
          gcheckboxgroup

 handler: Called when selection is changed

  action: Passed to handler when called.

container: Optional container to attach widget to

     ...: Ignored

 toolkit: Which GUI toolkit to use

_D_e_t_a_i_l_s:

     The basic methods all work similarly for these three widgets.

     The 'svalue' method returns the selected values by name. If the
     extra argument 'index=TRUE' is specified, the indices of the
     selected values is given. 

     The 'svalue<-' method can be used to set the selected value.

     The '"["' method refers to the vector defining the items.

     The '"[<-"' method can be used to change the vector defining the
     items. The length will most likely need to be the same.

     The '"length"' method returns the number of items.

     For 'gdroplist' the argument 'editable=TRUE' adds a text-edit box
     where the user can type in a selection. By default this value is
     returned as a character by 'svalue'. Use 'coerce.with' to coerce
     this prior to returning.

_E_x_a_m_p_l_e_s:

     ## Not run: 
       flavors = c("vanilla", "chocolate", "strawberry")

       group = ggroup(container=TRUE)
       add(group,glabel("Favorite flavor:"))
       add(group, gradio(flavors))

       group = ggroup(container=TRUE)
       add(group,glabel("Favorite flavor:"))
       add(group, gdroplist(flavors, editable =TRUE))

       group = ggroup(container=TRUE)
       add(group,glabel("Favorite flavors:"))
       add(group, obj <- gcheckboxgroup(flavors))

       svalue(obj) <- c(TRUE, FALSE, TRUE)
       svalue(obj)
       obj[3] <- "raspberry"

     ## End(Not run)

