|
From: David R. <dr...@jd...> - 2003-10-13 14:35:24
|
I have yet another difficulty I've run into. When a widget's size changes,
I can't figure out how to inform its parent that it needs to recalculate
its layout. In the following example, when the text changes to have two
lines, I'd like the window to rearrange itself (resizing if necesary) to
fit the new size of the text.
In wxwin itself I think one would call wxWindow::Layout on the parent to do
this, but I can't see how to do this in wxhaskell.
module Main where
import Graphics.UI.WX
main = start $ do f <- frame [text := "layout demo"]
h <- staticText f [text := "Hello world!"]
set h [on click := \_ -> goodbye h]
q <- button f [text := "quit", on command := close f]
set f [layout := column 5 [widget h,
widget q]]
goodbye st = do set st [text := "Goodbye world!\nAlas, I knew it well..."]
bs <- get st bestSize
set st [clientSize := bs]
--
David Roundy
http://www.abridgegame.org
|