English 中文(简体)
wxhaskell
原标题:Layout combinators in wxhaskell

我试图填满案文条目,以补整宽,如果这些条目直接放在框架上,但如果它们重新交给小组处理,它们就会重回其违约规模。 箱式布局合并案文也消失了。 我做了什么错误?

import Graphics.UI.WX

main = start gui

gui = do
  f <- frame []
  p <- panel f []
  xcoord <- entry p []
  ycoord <- entry p []
  set p [layout := fill $ boxed "foo" $
      grid 5 5 [
          [floatRight $ label "x   coordinate", hfill $ widget xcoord]
        , [floatRight $ label "y coordinate", hfill $ widget ycoord]
      ]
    ]
  set f [layout := fill $ container p glue]
最佳回答

页: 1

(container s second parameter is a layout for the container. glue is a layout, but not a sensible one for a panel.)

页: 1 类似:

import Graphics.UI.WX

main = start gui

gui = do
  f <- frame []
  p <- panel f []
  xcoord <- entry p []
  ycoord <- entry p []
  set p [layout := boxed "foo" $
      grid 5 5 [
          [floatRight $ label "x   coordinate", hfill $ widget xcoord]
        , [floatRight $ label "y coordinate", hfill $ widget ycoord]
      ]
    ]
  set f [layout := fill $ widget p]

或将您的所有布局代码移入集装箱内装饰末:

import Graphics.UI.WX

main = start gui

gui = do
  f <- frame []
  p <- panel f []
  xcoord <- entry p []
  ycoord <- entry p []
  set f [layout := fill $ container p $ boxed "foo" $
      grid 5 5 [
          [floatRight $ label "x   coordinate", hfill $ widget xcoord]
        , [floatRight $ label "y coordinate", hfill $ widget ycoord]
      ]]

但我更喜欢第一种,因为它认为对我更清洁,而且似乎更容易在你的主要框架中添加更多的内容:<代码>f。

问题回答

暂无回答




相关问题
How to start to create an application GUI using C#?

HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...

Automatic height of edit box

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 ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

UI And TcpClient Issue in vb.net

I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...

UI Convention: Shortcut key for application exit? [closed]

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...

热门标签