class TkObject - tk-0.2.0 Documentation

# class TkObject

### Public Instance Methods

destroy() click to toggle source

    # File lib/tk.rb, line 5032
    def destroy
      #tk_call 'trace', 'vdelete', @tk_vn, 'w', @var_id if @var_id
    end

epath() click to toggle source

    --> definition is moved to TkUtil module

def path

    @path

end

    # File lib/tk.rb, line 4928
    def epath
      @path
    end

event_generate(context, keys=nil) click to toggle source

# begin¶ ↑

    def [](id)
      cget(id)
    end

    def []=(id, val)
      configure(id, val)
      val
    end

# end¶ ↑

    # File lib/tk.rb, line 5008
    def event_generate(context, keys=nil)
      if context.kind_of?(TkEvent::Event)
        context.generate(self, ((keys)? keys: {}))
      elsif keys
        #tk_call('event', 'generate', path,
        #       "<#{tk_event_sequence(context)}>", *hash_kv(keys))
        tk_call_without_enc('event', 'generate', path,
                            "<#{tk_event_sequence(context)}>",
                            *hash_kv(keys, true))
      else
        #tk_call('event', 'generate', path, "<#{tk_event_sequence(context)}>")
        tk_call_without_enc('event', 'generate', path,
                            "<#{tk_event_sequence(context)}>")
      end
    end

method_missing(id, *args) click to toggle source
Calls superclass method Object#method_missing

    # File lib/tk.rb, line 4966
      def method_missing(id, *args)
        name = id.id2name
        case args.length
        when 1
          if name[-1] == ?=
            configure name[0..-2], args[0]
            args[0]
          else
            configure name, args[0]
            self
          end
        when 0
          begin
            cget(name)
          rescue
            if self.kind_of?(TkWindow) && name != "to_ary" && name != "to_str"
              fail NameError,
                   "unknown option '#{id}' for #{self.inspect} (deleted widget?)"
            else
              super(id, *args)
            end
    #        fail NameError,
    #             "undefined local variable or method `#{name}' for #{self.to_s}",
    #             error_at
          end
        else
          super(id, *args)
    #      fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
        end
      end

path() click to toggle source

/

    static VALUE
    tkobj_path(self)
        VALUE self;
    {
        return rb_ivar_get(self, ID_at_path);
    }

tk_send(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4936
    def tk_send(cmd, *rest)
      tk_call(path, cmd, *rest)
    end

tk_send_to_list(cmd, *rest) click to toggle source

private :tk_send, :tk_send_without_enc, :tk_send_with_enc

    # File lib/tk.rb, line 4947
    def tk_send_to_list(cmd, *rest)
      tk_call_to_list(path, cmd, *rest)
    end

tk_send_to_list_with_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4953
    def tk_send_to_list_with_enc(cmd, *rest)
      tk_call_to_list_with_enc(path, cmd, *rest)
    end

tk_send_to_list_without_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4950
    def tk_send_to_list_without_enc(cmd, *rest)
      tk_call_to_list_without_enc(path, cmd, *rest)
    end

tk_send_to_simplelist(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4956
    def tk_send_to_simplelist(cmd, *rest)
      tk_call_to_simplelist(path, cmd, *rest)
    end

tk_send_to_simplelist_with_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4962
    def tk_send_to_simplelist_with_enc(cmd, *rest)
      tk_call_to_simplelist_with_enc(path, cmd, *rest)
    end

tk_send_to_simplelist_without_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4959
    def tk_send_to_simplelist_without_enc(cmd, *rest)
      tk_call_to_simplelist_without_enc(path, cmd, *rest)
    end

tk_send_with_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4942
    def tk_send_with_enc(cmd, *rest)
      tk_call_with_enc(path, cmd, *rest)
    end

tk_send_without_enc(cmd, *rest) click to toggle source

    # File lib/tk.rb, line 4939
    def tk_send_without_enc(cmd, *rest)
      tk_call_without_enc(path, cmd, *rest)
    end

to_eval() click to toggle source

    # File lib/tk.rb, line 4932
    def to_eval
      @path
    end

### Private Instance Methods

tk_trace_variable(v) click to toggle source

    # File lib/tk.rb, line 5024
    def tk_trace_variable(v)
      #unless v.kind_of?(TkVariable)
      #  fail(ArgumentError, "type error (#{v.class}); must be TkVariable object")
      #end
      v
    end