Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (21 sloc) 664 Bytes

No. 4: button

The method call

button("Press Me")

creates a new button whereas

button("Press Me"){ alert("clicked")}

runs the associated block when the button is clicked. Finally

button("Press Me", :left => 50, :top => 20)

will place the button at the coordinates (50, 20).
That's all there is to know about buttons.

# sample5.rb
Shoes.app :width => 200, :height => 50 do
  button("Press Me", :left => 50, :top => 20) do
    alert("clicked")
  end
end

sample5.png

sample5.png

Policeman

The sample5.rb worked well with Shoes-0.r1263