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

Are You Sure You Want to Exit? and Other Dialog Methods

By

4 of 5

Asking for a Color
Are You Sure You Want to Exit? and Other Dialog Methods

Unlike the previous methods, asking for a color is not a straightforward action. How do you describe a color? Shoes provides a number of named colors, but users can't be expected to know these. To solve this problem, the ask_color method displays a color selection dialog. Again, be sure to store the color returned in a variable for future use.

Shoes.app :width => 200, :height => 80 do
  button "Change Color" do
    color = ask_color("What color?")
    background color
  end
end
  1. About.com
  2. Technology
  3. Ruby
  4. Graphical User Interfaces
  5. Shoes
  6. Asking for a Color

©2014 About.com. All rights reserved.