鞋子布局

发布于 2024-07-17 03:16:21 字数 376 浏览 7 评论 0原文

我正在尝试生成如下所示的鞋子布局:

示例 GUI 布局 http://csclub .uwaterloo.ca/~s3weber/gui.png

文本给我带来了问题。 我尝试过:

stack {
   flow {
      check
      stack {
         para 'text 1'
         para 'text 2'
      }
      para 'Free'
   }
}

但这根本不起作用。 有任何想法吗?

I'm trying to produce a shoes layout like the following:

example GUI layout http://csclub.uwaterloo.ca/~s3weber/gui.png

the text is giving me a problem. I tried:

stack {
   flow {
      check
      stack {
         para 'text 1'
         para 'text 2'
      }
      para 'Free'
   }
}

But that doesn't work at all. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风吹短裙飘 2024-07-24 03:16:21

您是否正确设置了所有元素的宽度?

Did you set the widths of all elements properly?

小巷里的女流氓 2024-07-24 03:16:21

在粒子中,对于后来的访问者,您需要设置流内堆栈的宽度,否则它将处于宽度 100%,并且 check 和 para 将被推送到它们自己的行。 像这样的东西效果很好,添加了边框来可视化盒子。

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

将堆栈的宽度设置为 -80 允许它使用行中的所有空间,并为其他组件留下 80 像素,这似乎是此类应用程序所需的行为。

另请注意,当您将隐式散列参数与大括号分隔的块结合使用时,Ruby 会感到困惑,因此您要么需要像我这里那样使用 do..end ,要么将要堆栈的参数括在括号内。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文