Method: TkcItem#initialize

Defined in:
lib/tk/canvas.rb

#initialize(parent, *args) ⇒ TkcItem

Returns a new instance of TkcItem.



736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/tk/canvas.rb', line 736

def initialize(parent, *args)
  #unless parent.kind_of?(Tk::Canvas)
  #  fail ArgumentError, "expect Tk::Canvas for 1st argument"
  #end
  @parent = @c = parent
  @path = parent.path

  @id = create_self(*args) # an integer number as 'canvas item id'
  CItemID_TBL.mutex.synchronize{
    CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
    CItemID_TBL[@path][@id] = self
  }
end