1. Computing
Send to a Friend via Email

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

By

1 of 6

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

To effectively use any GUI toolkit, you have to understand its layout manager (or geometry manager). In Qt, you have HBoxes and VBoxes, in Tk you have the Packer and in Shoes you have stacks and flows. It sounds cryptic but read on--it's very simple.

A stack does just as the name implies. They stack things vertically. If you put three buttons in a stack, they'll be stacked vertically, one on top of each other. If you run out of room in the window, a scrollbar will appear on the right side of the window to allow you to view all of the elements in the window.

Note that when it's said that the buttons are "inside" of the stack, it just means they were created inside of the block passed to the stack method. In this case, the three buttons are created while inside of the block passed to the stack method, so they're "inside" of the stack.

Shoes.app :width => 200, :height => 140 do
  stack do
    button "Button 1"
    button "Button 2"
    button "Button 3"
  end
end
  1. About.com
  2. Computing
  3. Ruby
  4. Graphical User Interfaces
  5. Shoes
  6. What's a Stack? What's a Flow? --The Shoes Layout Manager

©2014 About.com. All rights reserved.