Modified: MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb (516 => 517)
--- MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb 2008-08-29 20:16:43 UTC (rev 516)
+++ MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb 2008-08-29 20:16:54 UTC (rev 517)
@@ -5,21 +5,25 @@
end
def self.create
+ action = Proc.new {
+ alert(:message => "This is an alert!", :info => "This is a little more info!").show
+ }
+
layout_view :frame => [0, 0, 0, 0], :layout => {:expand => [:width, :height]} do |view|
- view << button(:title => "Rounded", :bezel => :rounded, :layout => {:expand => :width, :start => false})
- view << button(:title => "Regular Square", :bezel => :regular_square, :layout => {:expand => :width, :start => false})
- view << button(:title => "Thick Square", :bezel => :thick_square, :layout => {:expand => :width, :start => false})
- view << button(:title => "Thicker Square", :bezel => :thicker_square, :layout => {:expand => :width, :start => false})
- #view << button(:title => "", :bezel => :disclosure, :layout => {:expand => :width, :start => false})
- view << button(:title => "Shadowless Square", :bezel => :shadowless_square, :layout => {:expand => :width, :start => false})
- #view << button(:title => "", :bezel => :circular, :layout => {:expand => :width, :start => false})
- view << button(:title => "Textured Square", :bezel => :textured_square, :layout => {:expand => :width, :start => false})
- #view << button(:title => "Help Button", :bezel => :help_button, :layout => {:expand => :width, :start => false})
- view << button(:title => "Small Square", :bezel => :small_square, :layout => {:expand => :width, :start => false})
- view << button(:title => "Textured Rounded", :bezel => :textured_rounded, :layout => {:expand => :width, :start => false})
- view << button(:title => "Round Rect", :bezel => :round_rect, :layout => {:expand => :width, :start => false})
- view << button(:title => "Recessed", :bezel => :recessed, :layout => {:expand => :width, :start => false})
- #view << button(:title => "", :bezel => :rounded_disclosure, :layout => {:expand => :width, :start => false})
+ view << button(:title => "Rounded", :bezel => :rounded, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Regular Square", :bezel => :regular_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Thick Square", :bezel => :thick_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Thicker Square", :bezel => :thicker_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ #view << button(:title => "", :bezel => :disclosure, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Shadowless Square", :bezel => :shadowless_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ #view << button(:title => "", :bezel => :circular, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Textured Square", :bezel => :textured_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ #view << button(:title => "Help Button", :bezel => :help_button, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Small Square", :bezel => :small_square, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Textured Rounded", :bezel => :textured_rounded, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Round Rect", :bezel => :round_rect, :layout => {:expand => :width, :start => false}, :on_action => action)
+ view << button(:title => "Recessed", :bezel => :recessed, :layout => {:expand => :width, :start => false}, :on_action => action)
+ #view << button(:title => "", :bezel => :rounded_disclosure, :layout => {:expand => :width, :start => false}, :on_action => action)
end
end