1

I have a little program in haskell, using wxhaskell. It displays a window with a panel inside, containing some drawings. The problem is that the window shrinks to a very tiny size, and I have to expand it with the mouse.

How can I define correctly the size?

here is my program:

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) []

thank you.

4

1 回答 1

1

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

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

为我工作。

于 2016-04-07T08:54:11.433 回答