TkVarAccess (Class)

In: tk/lib/tk/variable.rb
Parent: TkVariable

Methods

new   new  

Public Class methods

[Source]

# File tk/lib/tk/variable.rb, line 799
  def self.new(name, *args)
    return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
    super(name, *args)
  end

[Source]

# File tk/lib/tk/variable.rb, line 804
  def initialize(varname, val=nil)
    @id = varname
    TkVar_ID_TBL[@id] = self

    # teach Tk-ip that @id is global var

    INTERP._invoke_without_enc('global', @id)

    if val
      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"

      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"

      #INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))

      #INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val)))

      self.value = val
    end
  end

[Validate]