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

What's a Stack? What's a Flow? --The Shoes Layout Manager

By

5 of 6

Dimensions
What's a Stack? What's a Flow? --The Shoes Layout Manager

Until now, we haven't given any dimensions when creating stacks and flow; they've simply taken as much space as they needed. However, dimensions can be given in the same way dimensions are given to the Shoes.app method call. This example creates a flow that's not as wide as the window and adds buttons to it. A border style is also given to it to visually identify where the flow is.

Shoes.app :width => 400, :height => 140 do
  flow :width => 250 do
    border red

    button "Button 1"
    button "Button 2"
    button "Button 3"
    button "Button 4"
    button "Button 5"
    button "Button 6"
  end
end

You can see by the red border that the flow doesn't extend all the way to the edge of the window. When the third button is going to be created, there's not enough room for it so Shoes moves down to the next line.

  1. About.com
  2. Technology
  3. Ruby
  4. Graphical User Interfaces
  5. Shoes
  6. Dimensions

©2014 About.com. All rights reserved.