Search code examples
user-interfacehaskellwxwidgetswxhaskell

wxHaskell : the window appears too tiny


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.


Solution

  • Setting a minimum size instead of the client size

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

    works for me.