[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

shoes toolket

Edward Redman

7/14/2008 11:05:00 PM

I have been trying to write a few programs with shoes.
I am wondering if there is a way to change the background from within
a button.

I have tried something like the following but it does not work.

Shoes.app 'change' do

button 'quit' do
exit
end

button 'change' do
background 'rgb(200,0,0)'
end
end

It should be quite easy I just am not clear on the syntex.

thanks
1 Answer

Edward Redman

7/15/2008 1:46:00 AM

0

On Mon, 14 Jul 2008 23:05:18 +0000, Edward Redman wrote:

> I have been trying to write a few programs with shoes. I am wondering if
> there is a way to change the background from within a button.
>
> I have tried something like the following but it does not work.
>
> Shoes.app 'change' do
>
> button 'quit' do
> exit
> end
>
> button 'change' do
> background 'rgb(200,0,0)'
> end
> end
>
> It should be quite easy I just am not clear on the syntax.
>
> thanks

I have figured it out.
it is not that I had it wrong. Just that the background was not
refreshed. by adding "self.show ". It now refreshes itself

here is the program as it stands.

Shoes.app do
background 'rgb(0, 0, 220)'
line 10,10,300,300
flow do
quit = button "quit" do
exit
end
button "change" do
color1 = rgb(rand(255),rand(255),rand(255))
background color1
self.show
end
button "change2" do
color2 = ask_color("Give me the Color")
puts color2.class
background color2
self.show
end
end
end