Skip to content

Instantly share code, notes, and snippets.

@wfarr
Created October 18, 2008 17:47
Show Gist options
  • Select an option

  • Save wfarr/17700 to your computer and use it in GitHub Desktop.

Select an option

Save wfarr/17700 to your computer and use it in GitHub Desktop.
require 'hotcocoa'
include HotCocoa
application do |app|
window :size => [200, 100] do |win|
win.view = layout_view :mode => :vertical do |layout|
layout.spacing = 10
b = button :title => "click me", :layout => {:align => :center}
l = label :text => "", :layout => {:align => :center}
b.on_action do |b|
if l.text == "" || l.text == "World foo"
l.text = "Hello"
else
l.text = "World foo"
end
end
layout << b
layout << l
end
win.will_close { exit }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment