widgetRender            package:tkWidgets            R Documentation

_R_e_n_d_e_r _a _T_k _W_i_d_g_e_t _f_r_o_m _G_i_v_e_n _S_p_e_c_i_f_i_c_a_t_i_o_n_s

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

     This function takes a list that specifies the appearance and
     behavior of a Tk widget and renders the widget accordingly.

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

     widgetRender(iWidget, tkTitle)

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

 iWidget: list of lists that specifies the appearance and behavior of
          the widget to be rendered.

 tkTitle: character string for the text to appear in the title bar of
          the widget to be rendered.

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

     The widget to be rendered normally consists of frames with three
     widgets arranged in a row. The first widget is normally a label
     for the name of the second widget. The second widget can be any
     type of widgets. The third widget is a button widget that defines
     some behavior to be associated with the second widget. For
     example, a button that will cause something to be displayed in the
     second widget when pressed. The third widget can be missing if no
     such association is required.

     The widget to be rendered also has two buttons at the bottom part
     of the widgets. The followings are the name and behavior of the
     buttons:


     *_C_a_n_c_e_l* - The unmodified list passed to the function at the time
          of invocation will be returned when pressed.

     *_E_n_d* - A modified version of the 'iWidget' argument will be
          returned when pressed.  The returned list has the same number
          of elements as the original one but with the values modified
          based on the entries in corresponding widgets items.

_V_a_l_u_e:

     A 'list' of lists with the original values of the passed modified
     or unmodified depending on whether the cancel or end button
     pressed.

_A_u_t_h_o_r(_s):

     Jianhua (John) Zhang

_R_e_f_e_r_e_n_c_e_s:

     Peter Dalgaard (2001) A Primer on the R-Tcl/Tk Package; R News *1*
     (3), 27-31 <URL: http://CRAN.R-project.org/doc/Rnews/>

_S_e_e _A_l_s_o:

     'fileBrowser', 'objectBrowser'.

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

     # Create the list to be passed
     pW1 <- list(Name="AAA", Value="bbb",
                 toText=function(x) paste(x,collapse= ","), fromText=NULL,
                 canEdit=TRUE,
                 buttonFun = fileBrowser, buttonText = "Browse")

     pW2 <- list(Name="BBB", Value="x,y,z",
                 toText=function(x) paste(x, collapse=","), fromText=NULL,
                 canEdit=TRUE, buttonFun = ls, buttonText = "List")

     pW3 <- list(Name="CCC", Value="ccc",
                 toText=function(x) paste(x, collapse = ","), fromText=NULL,
                 canEdit=TRUE, buttonFun=NULL,  buttonText=NULL)

     widget1 <- list(wList = list(a = pW1, b = pW2, c = pW3),
                     preFun  = function() "Hi",
                     postFun = function() "Bye")

     # Call the function
     if(interactive()){
         x <- widgetRender(widget1, "Test Widget")
         str(x)
     }

