[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Shoes GUI question - downloading body of sites using Ruby

Double Minus

10/12/2008 6:53:00 AM

Hi all,


I want to use shoes to be able to download the body of a website that a
user enters in an edit_line. How can I make this work? Can anyone help
explain why the below code does not work? It just pops up a new window,
and does not download the site from the text entered....

Here's my code thus far:

Shoes.app do
stack (:left => 175, :top => 200) do
para "Enter a url:"
flow do
@url = edit_line
button "OK" do

window do
stack do
title "Searching site", :size => 16
@status = para "One moment..."
# Search site for query and print body
download @url.text do |site|
@status.text = "Body: " + site.response.body.inspect
end
end
end
end
end
end
end
--
Posted via http://www.ruby-....

1 Answer

_why

10/13/2008 4:07:00 AM

0

On Sun, Oct 12, 2008 at 03:52:58PM +0900, Double Minus wrote:
> I want to use shoes to be able to download the body of a website that a
> user enters in an edit_line. How can I make this work?

You're very, very close. The problem is that instance variables
aren't shared between windows. You can use a normal variable `url`
or, if you really need to use an instance variable, you can use
`owner.instance_variable_get("@url")` to get to it.

A good section to read in the docs is the "Block Redirection"
stuff, basically the first two sections on this page:
<http://help.shoooes.net/Rule...

_why