
class Form < GoWindow
  attr_reader :main
  def initialize(label)

    @label=label
    super(@label)

    @main= TexturedPane.new(self,Defaults::DEFS['CommonBackground'],10,5,10,10).pack('fill'=>'both','ipadx'=>5,'ipady'=>5)
  end

  def add(widget,col,row)
    widget.grid('column'=>col,'row'=>row)
  end

  def add_frame(label,col,row)
    TkFrame.new(@main,TkDefaults::GUI[label]).grid('column'=>col,'row'=>row,'padx'=>5,'pady'=>5,'ipadx'=>5,'ipady'=>5)
  end

  def add_label(frame,label,col,row)
    opts= TkDefaults::GUI[label]
    TkLabel.new(frame,opts).grid('column'=>col,'row'=>row,'sticky'=>'e','padx'=>2,'pady'=>2)
  end

  def add_empty(frame,col,row,colspan,rowspan)
    TkLabel.new(frame).grid('column'=>col,'row'=>row,
                            'columnspan'=>colspan,'rowspan'=>rowspan)
  end

  def add_field(frame,label,var,st,col,row)
    opts= TkDefaults::GUI[label].update('textvariable'=> var,'state'=>st)
    TkEntry.new(frame,opts).grid('column'=>col,'row'=>row,'sticky'=>'we')
  end

  def add_radio(frame,var,col,row,*list)
    f= TkFrame.new(frame).grid('column'=>col,'row'=>row)
    list.each { |opt| TkRadioButton.new(f,'text'=> opt, 'variable'=>var, 'value'=>opt).pack }
  end


  def add_check(frame,label,variable,col,row)
    opts= TkDefaults::GUI[label].update('variable'=>variable)
    CheckButton.new(frame,opts).grid('column'=>col,'row'=>row,'sticky'=>'w')
  end

  def add_menu(frame,var,col,row,*list)
    list.delete(var.value)
    b=TkOptionMenubutton.new(frame,var,nil,*list).grid('column'=>col,'row'=>row)
  end



end
