Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

give sizes to labels

  • Loading branch information...
commit 3dde29c33d855ea9aa7417af464fd3da5c395c4f 1 parent 91701ae
@drnic authored
View
22 download_and_scrape_html/Download And Scrape Html.app/Contents/Resources/lib/application.rb
@@ -7,14 +7,14 @@ class Application
include HotCocoa
def start
- application :name => "Download And Scrape Html" do |app|
- app.delegate = self
- window :frame => [100, 100, 500, 500], :title => "Download And Scrape Html" do |win|
- @l = label(:text => "Hello from HotCocoa", :layout => {:start => false})
- win << @l
- url = NSURL.URLWithString("http://github.com/drnic")
- request = NSURLRequest.requestWithURL(url)
- # NSURLConnection.alloc.initWithRequest_delegate_startImmediately(request, self)
+ application :name => "Download And Scrape Html" do |app|
+ app.delegate = self
+ window :frame => [100, 100, 500, 500], :title => "Download And Scrape Html" do |win|
+ win << label(:text => "Hello from HotCocoa", :layout => {:start => false})
+ win << (@didReceiveResponse = label(:text => "...", :layout => {:start => false}, :frame => [0, 0, 300, 20]))
+ win << (@didReceiveData = label(:text => "...", :layout => {:start => false}, :frame => [0, 0, 300, 20]))
+ url = NSURL.URLWithString("http://github.com/drnic")
+ request = NSURLRequest.requestWithURL(url)
NSURLConnection.connectionWithRequest(request, delegate: self)
win.will_close { exit }
end
@@ -23,11 +23,11 @@ def start
def connection(connection, didReceiveResponse:didReceiveResponse)
- @l.text = "connection_didReceiveResponse"
+ @didReceiveResponse.text = "connection_didReceiveResponse"
end
def connection(connection, didReceiveData:didReceiveData)
- @l.text = "connection_didReceiveData"
+ @didReceiveData.text = "connection_didReceiveData"
end
@@ -56,4 +56,4 @@ def on_bring_all_to_front(menu)
end
end
-Application.new.start
+Application.new.start
View
21 download_and_scrape_html/lib/application.rb
@@ -7,13 +7,14 @@ class Application
include HotCocoa
def start
- application :name => "Download And Scrape Html" do |app|
- app.delegate = self
- window :frame => [100, 100, 500, 500], :title => "Download And Scrape Html" do |win|
- @l = label(:text => "Hello from HotCocoa", :layout => {:start => false})
- win << @l
- url = NSURL.URLWithString("http://github.com/drnic")
- request = NSURLRequest.requestWithURL(url)
+ application :name => "Download And Scrape Html" do |app|
+ app.delegate = self
+ window :frame => [100, 100, 500, 500], :title => "Download And Scrape Html" do |win|
+ win << label(:text => "Hello from HotCocoa", :layout => {:start => false})
+ win << (@didReceiveResponse = label(:text => "...", :layout => {:start => false}, :frame => [0, 0, 300, 20]))
+ win << (@didReceiveData = label(:text => "...", :layout => {:start => false}, :frame => [0, 0, 300, 20]))
+ url = NSURL.URLWithString("http://github.com/drnic")
+ request = NSURLRequest.requestWithURL(url)
NSURLConnection.connectionWithRequest(request, delegate: self)
win.will_close { exit }
end
@@ -22,11 +23,11 @@ def start
def connection(connection, didReceiveResponse:didReceiveResponse)
- @l.text = "connection_didReceiveResponse"
+ @didReceiveResponse.text = "connection_didReceiveResponse"
end
def connection(connection, didReceiveData:didReceiveData)
- @l.text = "connection_didReceiveData"
+ @didReceiveData.text = "connection_didReceiveData"
end
@@ -55,4 +56,4 @@ def on_bring_all_to_front(menu)
end
end
-Application.new.start
+Application.new.start
Please sign in to comment.
Something went wrong with that request. Please try again.