addItems               package:svMisc               R Documentation

_A_d_d _i_t_e_m_s _f_r_o_m _o_n_e _v_e_c_t_o_r _t_o _a_n_o_t_h_e_r _o_n_e _w_i_t_h _o_r _w_i_t_h_o_u_t _r_e_p_l_a_c_e_m_e_n_t

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

     The function takes the (named) items of one vector and place them
     in a second vector if these names do not exist yet there, or
     replace corresponding content.

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

     addItems(x, y, use.names = TRUE, replace = TRUE)
     addActions(obj = ".svActions", text = NULL, code = NULL, state = NULL,
             options = NULL, replace = TRUE)
     addIcons(obj = ".svIcons", icons, replace = TRUE)
     addMethods(methods)

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

       x: The vector to add items to 

       y: The vector of which we want to inject missing items in 'x' 

use.names: Use names of items to determine which one is unique,
          otherwise, the selection is done on the items themselves 

 replace: Do we replace existing items in 'x'? 

     obj: The name of the object in 'TempEnv()' to manipulate 

    text: The text of actions to add (label on first line, tip on other
          lines) 

    code: The R code of actions to add 

   state: The default (strating) state of an action, as a succession of
          letters: \"c\" = checked, \"u\" = unchecked (default); \"d\"
          = disabled, \"e\" = enabled (default); \"h\" = hidden, \"v\"
          = visible (default). Default values are facultative. Ex:
          'udv' means: unchecked - disabled - visible and it equals to
          simply 'd' 

 options: A character vector with other options to pass to the
          graphical toolkit for this action 

   icons: A named character vector matching names of actions/panels
          with the URL or file name of icon resources accessible by the
          GUI client 

 methods: The methods to add to 'getOption("svGUI.methods")'. This
          information is used to compute a list of possible methods for
          a given object, for instance, in the context menu of an
          object explorer (see 'objMenu()')

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

     Philippe Grosjean <phgrosjean@sciviews.org>

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

     'listMethods', 'objMenu', 'TempEnv'

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

     # I have a vector v1 with this:
     v1 <- c(a = "some v1 text", b = "another v1 text")
     # I want to add items whose name is missing in v1 from v2, without touching the rest
     v2 <- c(a = "v2 text", c = "the missign item")
     addItems(v1, v2, replace = FALSE)
     # Not the same as
     addItems(v1, v2, replace = TRUE)
     # This yield different result (names not used and lost!)
     addItems(v1, v2, use.names = FALSE)

     # This is useful to add actions, icons, descriptions, shortcuts or methods
     # specifs (see addMenuItem())

