如何让一个元素占据所有剩余宽度?
Shoes.app do
flow do
file = "something with variable length"
para "Loading #{file}: "
progress :width => -300
end
end
正如您从代码中看到的,我试图显示一个从文本末尾一直到应用程序窗口右边缘的进度条。 当文本具有固定长度时,此解决方案有效,但一旦文本在上面的片段中改变长度,它就不起作用:进度条的空间太小或太多。
这个问题有解决办法吗?
我尝试询问 para 元素的宽度,但它是 0???
Shoes.app do
flow do
file = "something with variable length"
para "Loading #{file}: "
progress :width => -300
end
end
As you can see from the code I am trying to display a progress bar that goes from the end of the text until the right edge of the application window.
When the text has a fixed length this solution works but it doesn't once the text changes length in the above fragment: there will be either too little or too much space for the progress bar.
Is there a solution to this problem?
I tried asking the para element it's width but it is 0???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我之前提到的,您必须获取文本块的宽度计算出来之后。 尝试这个:
As I mentioned before, you have to get the width of the textblock after it is calculated. Try this: