The full explanation is a bit tricky (tricky enough that I don't fully understand or I would have fixed it!), but results from the way in which Layout works. Layout is a neat idea, but has a number of quirks. The main thing to realize is that Layout creates an hierarchy of Sizer instances which contain your control instances. The interaction between the Sizers and control size constraints can be tricky to fathom, but basically the Sizer constraints seem to override clientsize directives.

My best advice would be to use either Layout and nothing else (as Carlos suggests) or use Sizers manually and ignore Layout. I used this alternative approach in m Custom Control tutorial - see http://wewantarock.wordpress.com/2010/01/10/custom-controls-in-wxhaskell-part-2/

Regards
Jeremy

On 31 May 2011 23:05, carlos gomez <carliros.g@gmail.com> wrote:
I don't understand too. Looks like some misterious thing is happening.
But you can use the 'mimsize' layout funcion from WXCore in order to get what you want.

Here the code:


module Main where

import Graphics.UI.WX

main::IO()

main = start gui

gui :: IO ()

gui = do f <- frame [text := "timer"]
         panel <- panel f [clientSize := sz 200 100]
         hr  <- textEntry   panel 
                            [ text := "hour"
                            , clientSize := sz 10 10
                            ]
         min <- button      panel 
                            [ text := "min"
                            , clientSize := sz 10 10
                            ]
         sec <- textEntry   panel 
                            [ text := "sec"
                            , clientSize := sz 10 10
                            ]
         -- layout
         set panel [layout := margin 10 $  row 1 [ minsize (sz 10 10) $ widget hr
                                                 , widget min
                                                 , minsize (sz 10 10) $ widget sec
                                                 ]
                   ]
         set f [layout := widget panel]



On 30 May 2011 05:49, 诺铁 <notyycn@gmail.com> wrote:
Hi,
     I am learning wxHaskell,and trying to create a small timer app. I don't understand why in following code ,clientSize only affect button control

module Main where

import Graphics.UI.WX

main::IO()
main = start gui

gui :: IO ()
gui = do
f <- frame [text := "timer"]
panel <- panel f [clientSize := sz 200 100]
hr <- textEntry panel [text := "hour",clientSize := sz 10 10]
min <- button panel [text := "min",clientSize := sz 10 10]
sec <- textEntry panel [text := "sec",clientSize := sz 10 10]
-- layout
set panel [layout := margin 10 $ row 1 [widget hr,widget min,widget sec]]
set f [layout := widget panel]

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users



------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users