tags:

views:

236

answers:

2
+2  Q: 

Shoes Layout

+1  A: 

Did you set the widths of all elements properly?

zvolkov
What widths would be "properly" in this case?
singpolyma
Well you need to make sure that widths of the children of the flow add up to the width of the flow itself otherwise the flow will wrap them down.
zvolkov
Oh, you're right! The stack is automatically 100% :(Is there someway to size it to its contents?
singpolyma
I don't think it's possible although I'm no way an expert in shoes.
zvolkov
A: 

In particle, for later visitors, you need to set the width of the stack inside the flow because otherwise it will be at width 100% and the check and para will be pushed to their own rows. Something like this works great, with an added border to visualize the box.

Shoes.app do
  stack {
    flow {
      border black
      check 
      stack :width=>-80 do
        para 'text 1'
        para 'text 2'
      end
      para 'Free'
    }
  }
end

Setting the width of the stack to -80 allow it to use all of the space in the row and leave 80 pixels for the other components, which appears to be the desired behavior for an app like this.

Note also that Ruby is confused when you use an implicit hash parameter in conjunction with a block delimited by braces, so you either need to use do..end as I have here or enclose the parameters to stack inside of parentheses.

Jonathan Branam