From: D.V. <dav...@gm...> - 2011-09-14 14:39:58
|
And after seeing a post on the list about this same problem, I've found a way around : -- Bonjour List, -- -- I've got this program which segfaults. If you remove fontSize:=10 it runs, but the widgets completely ignore the size I giv e them -- -- Here's the code: module Main where import Control.Monad import Graphics.UI.WX hiding (when) import Graphics.UI.WXCore hiding (when) import Graphics.UI.WXCore.WxcTypes stats = do dlg <- frame [ text := "Title"] font <- fontCreate 8 6 0 0 False "" wxFONTENCODING_SYSTEM -- wxFONTFAMILY_TELETYPE wxFONTSTYLE_NORMAL wxFONTWEIGHT_NORMAL let zone a = do tz <-textEntry dlg [ text:="", enabled:=False ,alignment := a ] windowSetFont tz font return tz aligns = replicate 14 AlignLeft lzone <- mapM zone aligns let zrow l n s = row 5 $ concat $ zipWith3 labzone l n s -- I could do better by calculing this from the font... it's good enough for now. zsz s = minsize (sz (s*12+8) 20) labzone l n s = if null l then [ zsz s $ widget (lzone !! n) ] else [ label l,zsz s $ widget (lzone !! n) ] form = margin 10 $ column 5 [ label "titletile", zrow ["xxxx:","xxxx:","xxx:","xx:","x:","x:","xxxx.:"] [0..6] [3,15,1,4,1,1,3], zrow ["xxx:","xxx:","xxx:","","xxxxx:","xxx:","xxx:"] [7..13] [3,3,3,10,1,1,5] ] set dlg [layout := form ] main = start stats ================================ Unresolved problem: why did fontSize make the program crash ? |