ggenericwidget           package:gWidgets           R Documentation

_A _c_o_n_s_t_r_u_c_t_o_r _t_o _c_r_e_a_t_e _w_i_d_g_e_t_s _f_o_r _e_v_a_l_u_a_t_i_n_g _f_u_n_c_t_i_o_n_s

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

     This constructor creates a widget for collecting arguments for a
     function using a list to define the widget's components. When
     called with a function name a list is created on the fly which can
     be used as is, or modified as desired.

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

     ggenericwidget(lst,  cli = NULL, container = NULL, ..., toolkit = guiToolkit())

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

     lst: Either a list defining the widget or a function name as a
          string. In the latter case, the defining list may be
          retrieved by the 'svalue' method.

     cli: An instance of 'gcommandline' or NULL. If NULL, then a new
          command line pops up in its own window

container: Optional container to attach widget to

     ...: Currently ignored by 'ggenericwidget', but passed along to
          'gedit' by 'geditlist' and 'geditnamedlist'

 toolkit: Which GUI toolkit to use

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

     This widget provides an easy way to create dialogs that collect
     the arguments for a function evaluation. When the OK button is
     clicked, the arguments are collected and passed along to the
     function specified via the 'action' part of the list. When
     collecting the arguments, empty strings are not passed along. 

     The easiest usage is to simply provide a function name and have
     'autogenerategeneric' take a stab. However, in the long run it
     might be better to use 'autogenerategeneric' to create an initial
     list, and then modify this to adjust the widget's look.

     The list contains several named components

_t_i_t_l_e The title for the widget

_h_e_l_p What help page is called

_t_y_p_e Either "text" or "graphic." Currently ignored.

_v_a_r_i_a_b_l_e_T_y_p_e Describes the type of variable. Either "univariate",
     "univariatetable","fileurl","bivariate", "model", "lattice",
     "lmer" or 'NULL'.  This value is passed directly to 'gvariables'.
     For non-NULL values, the widget shows an appropriate area for
     collecting the main variable. For the model and lattice interfaces
     buttons allow editing of fields by subsequent dialogs. 

_v_a_r_i_a_b_l_e_T_y_p_e_E_x_t_r_a_s An optional list with components 'name' and 'value'
     containing a name and value passed along to the constructor for
     the variable type. Useful to override default

_a_s_s_i_g_n_t_o If TRUE, creates box for collecting name for assigning output

_a_c_t_i_o_n a list with named components 'beginning' and 'ending'. The
     arguments are collected and pasted together to form a string
     containing the R command to execute. These get put at the
     beginning and end of the string. A typical pair would be something
     like "prop.test(" and ")".

_a_r_g_u_m_e_n_t_s a list with named components. In the simplest usage the names
     are argument names, and the components are lists with entries that
     create the corresponding widget. The first such component is
     called 'type' and is the name of a gWidget, such as '"gradio"'.
     Subsequent components are passed to this function using 'do.call'.

     The constructors 'geditlist' and 'geditnamedlist' can be used when
     the input is to be a list of values or a list of named values.

     In the more complicated cases, these named components can be
     grouped into a list component. The name of this is then used to
     block the arguments. See the example. 

     The 'svalue' method returns the value of the list. This can be
     used to retrieve the list that is created when the constructor is
     called with a function name.

_N_o_t_e:

     This function may be improved and the list defining it changed.

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

     ## Not run: 
             ## a sample list definition
     ## Save some typing by defining a list to be used more than once later
     TRUE.list = list(
       type = "gradio",
       items = c("TRUE","FALSE")
       )

     ## define a list for producing a histogram widget         
     hist.list = list(
       title = "hist()",
       help = "hist",
       action = list(
         beginning = "hist(",
         ending = ")"
         ),
       type = "graphic",                      # either text or graphic
       variableType = "univariate",           # single variable
       arguments = list(
         adjustments = list(
           breaks= list(
             type="gdroplist",
             items=c("\"Sturges\"","\"Scott\"","\"Friedman-Diaconis\"")
             ),
           probability = TRUE.list,
           include.lowest = TRUE.list,
           right = TRUE.list,
           shading = list(
             density = list(
                 type="gedit",
                 text=NULL
             ),
           angle = list(
             type="gedit",
             coerce.with="as.numeric",
             text="45"
             )
             )
           )
         )
       )

     ggenericwidget(hist.list, container=TRUE)
     ## or to autogenerate one
     ggenericwidget("boxplot.default", container=TRUE)
             
     ## End(Not run)

