Method: TkcItem#initialize

Defined in:
ext/lib/tk/canvas.rb

#initialize(parent, *args) ⇒ TkcItem

Returns a new instance of TkcItem.



686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'ext/lib/tk/canvas.rb', line 686

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