Created
December 15, 2008 01:49
-
-
Save levicole/35845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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