Skip to content

Instantly share code, notes, and snippets.

@levicole
Created December 15, 2008 01:49
Show Gist options
  • Save levicole/35845 to your computer and use it in GitHub Desktop.
Save levicole/35845 to your computer and use it in GitHub Desktop.
require 'hotcocoa'
include HotCocoa
application do |app|
# setting up our window with
window :size => [150, 50] do |win|
# now lets set up our layout
win.view = layout_view :mode => :horizontal do |layout|
layout.spacing = 5
# make a button
b = button(:title => 'Hi!', :layout => { :align => :center})
# now create an label for the message
l = label(:text => "", :layout => { :align => :center, :bottom_padding => 3},
:bordered => true, :frame => [20,75,75,20])
# add an action to the button that replaces the empty label with the text hello world.
b.on_action {l.text = "hello world!" }
# insert the button first
layout << b
# now the label
layout << l
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment