首页 > 解决方案 > 如何更改 Threepenny GUI 中的按钮布局和位置?

问题描述

如何在使用 threepenny-gui 包创建的 GUI 中更改按钮或其他 UI 元素的大小和位置?

文档Graphics.UI.Threepenny.Attributes列出了一些可能有用的函数,例如coords :: WriteAttr Element String. 但是,我不明白如何使用它们。具体来说,我不明白这个String论点应该是什么。

谢谢

标签: haskellthreepenny-gui

解决方案


Threepenny UI element combinators translate more or less directly to HTML, and so you should think in terms of HTML when doing layout with it:

  • The attributes from Graphics.UI.Threepenny.Attributes you mention are HTML attributes. Modifying them while defining your initial layout is typically done with set. (By the way, if you need a reference for looking up what things like HTML attributes do, you can't do wrong with MDN.)

  • For CSS styling, you can use the (#.) combinator.

  • As for layout, the basic tools are (#+) to nest HTML elements, and grid, row and column to arrange div-based grids.


推荐阅读