Hi Dean

Dean Herington wrote:
> Is anyone out there???
Yes.

> 
> I reread Daan's original paper and found a hint that layouts need to 
> mention each widget exactly once (though I can't find anything 
> definitive in documentation for either wxhaskell or wxwidgets). 
> Obeying that "rule" avoids the garbling, but I'm still not able 
> successfully to change the layout repeatedly.  Even if I could, how 
> then would I show different subsets of widgets at different times?
Every widget which is created must be used once and only once. That is
the rule.

In your action (the "on command := do" -stuff) to change the panel
content do:

1) delete your old widgets like:

get p children >>= mapM_ objectDelete

2) create new widgets

3) do "set p [ layout := ... ].

4) finally it might be good to do "refit p".

Also have a look at dynamic
http://wxhaskell.sourceforge.net/doc/Graphics-UI-WXCore-Layout.html#v%
3Adynamic . I am no quite sure when it is necessary to use this
function.


Greetings,

Mads

> 
> Is there any hope of getting a decent description of wxhaskell's 
> (intended) semantics?  I'm getting exasperated.
> 
> At 12:08 AM -0400 5/9/08, Dean Herington wrote:
> >I'm using wxhaskell 0.10.3 with ghc 6.8.2 on Windows XP Pro.  I'm
> >trying to figure out how to change the content of a frame
> >dynamically.  The program shown below has several problems:
> >    * The initial text is garbled (a combination of "Screen 1" and "Screen 
> > 2").
> >    * The button label doesn't change when first clicked.
> >    * Nothing changes on subsequent button presses.
> >Any ideas?
> >
> >>   module Main where
> >>
> >>   import Graphics.UI.WX
> >>
> >>   main = start gui
> >>
> >>   gui = do
> >>     f    <- frame [text := "Test 1"]
> >>     p    <- panel f []
> >>     t1   <- staticText p [text := "Screen 1"]
> >>     b1   <- button p [text := "switch to 2"]
> >>     t2   <- staticText p [text := "Screen 2"]
> >>     b2   <- button p [text := "switch to 1"]
> >>     set b1 [on command := switch f p t2 b2]
> >>     set b2 [on command := switch f p t1 b1]
> >>     switch f p t1 b1
> >>
> >>   switch f p t b = set f [layout := fill $ container p $ margin 10 $
> >  >column 5 [widget t, widget b]]
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft 
> Defy all challenges. Microsoft(R) Visual Studio 2008. 
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> wxhaskell-users mailing list
> wxhaskell-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxhaskell-users



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to