[macruby-changes] [517] MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 29 13:16:55 PDT 2008


Revision: 517
          http://trac.macosforge.org/projects/ruby/changeset/517
Author:   rich at infoether.com
Date:     2008-08-29 13:16:54 -0700 (Fri, 29 Aug 2008)
Log Message:
-----------
add alert demo

Modified Paths:
--------------
    MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb

Modified: MacRuby/trunk/sample-macruby/HotCocoa/demo/lib/views/buttons.rb
===================================================================
--- 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
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080829/76001bad/attachment.html 


More information about the macruby-changes mailing list