Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save wfarr/17701 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
btn = button(:title => "click me", :layout => {:align => :center})
lbl = label(:text => "text", :layout => {:align => :center})
btn.on_action do |b|
if lbl == "text" || lbl == "World foo"
lbl.text = "Hello"
else
lbl.text = "World foo"
end
end
layout << btn
layout << lbl
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