Method: Tk::RadioButton#set_value

Defined in:
lib/tk/radiobutton.rb

#set_value(val) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/tk/radiobutton.rb', line 57

def set_value(val)
  var = tk_send_without_enc('cget', '-variable')
  if TkVariable::USE_TCLs_SET_VARIABLE_FUNCTIONS
    _fromUTF8(INTERP._set_global_var(var, _get_eval_string(val, true)))
  else
    s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
    INTERP._eval(Kernel.format('global %s; set %s %s', var, var, s))
  end
end