# File tst/tst_locana.rb, line 186 def tst_color() Lwindow.new(:TestColor, :pos=>[0, 0], :text => 'Test Colors', :fg=>:darkblue, :bg=>:beige) { label(:l1, :padx=>5, :pady=>5, :text => "This tests colors for most objects") b = 0 # we are going to print buttons twice, once with parent color and once with specified color, because buttons should not inherent color [Lgroup, Llabel, Lbutton, Lbutton, Lcheckbox, Lradiobox, Ltextbox, Lcombobox, Ldatebox].each do |obj| group("#{obj.class.name}_#{y}".intern, :startx=>10, :below=>:prev, :padx=>5, :pady=>5, :bg=>:lightblue, :fg=>:red, :bcolor=>:blue) { label(obj.class.name.intern, :pos=>[2, 2], :text=>"#{obj.name}:") x = 100 borders = Lborder.supported_borders.keys.sort {|k1, k2| k1.to_s <=> k2.to_s} borders[0,0] = nil borders.each do |border| attr = {:border => border} if (obj == Ltextbox) attr[:value] = 'Test' attr[:bg] = :LightGreen attr[:fg] = :DarkBlue attr[:bcolor] = :DarkRed # not yet supported elsif (obj == Lcombobox) attr[:text] = ['Test', 'Test2'] attr[:value] = 'Test' # needs both elsif (obj == Ldatebox) attr[:value] = Time.now elsif (obj == Lbutton) attr[:text] = 'Test' if (b == 0) attr[:bg] = :LightGreen attr[:fg] = :DarkBlue attr[:bcolor] = :DarkRed # not yet supported end elsif (obj == Lgroup) attr[:height] = 22 # otherwise the calculated height will be 0 and we won't be able to see it else attr[:text] = 'Test' end attr[:pos] = [x, 0, 70] add(obj.new("#{obj.class.name}_#{y}_#{border}".intern, attr)) x += 80 end b += 1 if (obj == Lbutton) } end button(:b_ok, :sticky=>:se, :padx=>10, :pady=>10, :text=>'Ok', :tab_order=>0) # make sure this starts with the keyboard focus b_ok.on_click = "close()" # this button will close the form } end