wxHaskell:窗口看起来太小了

时间:2016-04-06 19:54:25

标签: user-interface haskell wxwidgets wxhaskell

我在haskell中有一个小程序,使用wxhaskell。它显示一个窗口,里面有一个面板,包含一些图纸。问题是窗口缩小到非常小的尺寸,我必须用鼠标扩展它。

如何正确定义尺寸?

这是我的计划:

module Main where
import Graphics.UI.WX
import Graphics.UI.WXCore

main :: IO ()
main
  = start hello

hello :: IO ()
hello = do 
        f    <- frame    [text := "HELLO!"]
        sw <- panel f [ on paint := onpaint]
        set f   [clientSize  := sz 300 300,
                layout := fill $ widget sw]
        return()

    where 
        onpaint dc pnel = do 
            circle dc (pt 200 200) 20 [penKind := PenDash DashDot]
            drawPoint dc (pt 200 200) []
谢谢。

1 个答案:

答案 0 :(得分:1)

设置最小尺寸而不是客户端尺寸

set f [ layout := minsize (sz 300 300) $ widget sw ]

适合我。