1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Click Blocks and Animation

By

2 of 5

Assigning Click Blocks
Click Blocks and Animation

The click method is only useful for assigning a click block to a container. To assign a click block to any other element, you'll need to use the click assignment method. Th following example creates an image and stores it in a variable. That image's click assignment method is called, assigning a click block to the image. This same method can be used to give any element a click block.

Shoes.app :width => 400, :height => 300 do
  @img = image 'shoes-logo.png'
  @img.click do
    @box.append para("You clicked the image\n")
  end

  @box = stack
end
  1. About.com
  2. Technology
  3. Ruby
  4. Graphical User Interfaces
  5. Shoes
  6. Assigning Click Blocks

©2014 About.com. All rights reserved.