编辑框自动高度

发布于 2024-08-10 19:05:22 字数 225 浏览 3 评论 0原文

我的鞋子应用程序按顺序将三个项目堆叠在一起(当然是一个堆栈):

  • 横幅
  • 一个编辑框
  • 流程中的两个按钮

我想要做的是让横幅保持其默认大小(48 像素) )和按钮(我认为这可能是特定于平台的?)并让编辑框占据屏幕上的剩余区域,并随窗口自动调整大小?这可能吗?

如果没有,是否可以将按钮移到编辑框上方? (因此编辑框将填充到窗口底部)

My shoes application has three items stacked on top of each other (with a stack, of course), in order:

  • A banner
  • An edit box
  • Two buttons in a flow

What I want to do is have the banner stay at it's default size (48px) and the buttons as well (I think this may be platform specific?) and have the edit box take up the remaining area on screen, and automatically resize with the window? Is this possible?

If not, would it be possible if the buttons were moved above the edit box? (So the edit box would fill to the bottom of the window)

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

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

发布评论

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

评论(1

千里故人稀 2024-08-17 19:05:22

我不能完全相信这一点,因为它是受到这个 电子邮件线程的启发 和该线程中链接的代码,但以下内容有效;虽然很粗糙(它每秒轮询窗口以调整大小)。

Shoes.app do
    @header = stack :height => 48 do
        background red
    end
    stack do 
        @edit = edit_box
    end
    @footer = flow do
        style(:attach => Window, :top => app.height-100, :height => 25)
        button "Button 1"
        button "Button 2"
    end
    @height = 0
    every(1) do
        @windowheight = slot.height
        # Note app.height works on Linux and Windows, but not on OSX
        # See http://article.gmane.org/gmane.comp.lib.shoes/3493/match=app+height
        # So use slot.height instead. 
        unless @windowheight == @height
            @edit.style(:height => @[email protected]@footer.height)
            @footer.style(:top => @windowheight-25)
        end
    end
end

据我所知,如果您将按钮移动到编辑框上方,您仍然需要执行相同的操作才能动态调整其大小。不过,您可以询问新的 Shoes 邮件列表:[电子邮件受保护]

I can't take full credit for this, as it is inspired by this email thread and code linked in that thread, but the below works; although is crude (it polls the window every second in order to adjust sizes).

Shoes.app do
    @header = stack :height => 48 do
        background red
    end
    stack do 
        @edit = edit_box
    end
    @footer = flow do
        style(:attach => Window, :top => app.height-100, :height => 25)
        button "Button 1"
        button "Button 2"
    end
    @height = 0
    every(1) do
        @windowheight = slot.height
        # Note app.height works on Linux and Windows, but not on OSX
        # See http://article.gmane.org/gmane.comp.lib.shoes/3493/match=app+height
        # So use slot.height instead. 
        unless @windowheight == @height
            @edit.style(:height => @[email protected]@footer.height)
            @footer.style(:top => @windowheight-25)
        end
    end
end

As far as I know, if you moved the buttons above the edit box, you would still have to do the same kind of thing in order to have it dynamically resize. There is a new mailing list for Shoes you could ask on though: [email protected]

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