Henning Thielemann | 6 Dec 20:05 2011
Picon

adapt layout after changing 'visible' state


I have a textCtrl 'editor' and a menu item 'editorVisible' that controls 
the visibility of the textCtrl.

     set editorVisible
         [ on command := do
              b <- get editorVisible checked
              set editor [ visible := b ] ]

Now when I uncheck the menu item editorVisible, then the editor actually 
disappears, but its space becomes empty and is not occupied by the other 
widgets in the GUI. When I resize the window then all widgets are 
relayouted and the space of the invisible textCtrl is covered by the other 
widgets. That is the result that I want to have, but without resizing the 
window. Vice versa when I make the editor visible via the menu, then it 
cannot be seen immediately but only after window resizing.

How can I achieve immediate relayout of the window when changing the 
showing or hiding the editor? I tried 'refresh editor' and 'refresh panel' 
and 'refresh frame' (where panel and frame are the surrounding widgets) 
but this does not trigger new layout.

I use wxwidgets-2.8 on GTK and Linux.

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
(Continue reading)

Eric Kow | 6 Dec 20:25 2011
Picon

Re: adapt layout after changing 'visible' state

Hi,

On 6 Dec 2011, at 19:05, Henning Thielemann wrote:
> How can I achieve immediate relayout of the window when changing the 
> showing or hiding the editor? I tried 'refresh editor' and 'refresh panel' 
> and 'refresh frame' (where panel and frame are the surrounding widgets) 
> but this does not trigger new layout.

I'm sorry I don't have an answer for you, but this appears to be a great candidate for an FAQ, the kind of thing
people would run into often.

If you get answer from somebody on the list, would you be willing to add a Howto section to the FAQ of some sort,
with your question?
http://www.haskell.org/haskellwiki/WxHaskell/FAQ

FWIW, I have a 'repaint' in my code, but that may not have anything to do with your issue.

--

-- 
Eric Kow <http://erickow.com>

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
------------------------------------------------------------------------------
(Continue reading)

Jesse Hester | 6 Dec 21:02 2011
Picon

Please remove me from the wxhaskell list for now.

Thanks,

Jesse Hester

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
Dave Tapley | 6 Dec 21:08 2011
Picon

Re: Please remove me from the wxhaskell list for now.

On 6 December 2011 20:02, Jesse Hester <hester.j@...> wrote:
> Thanks,
>
> Jesse Hester

You'll probably have to do it yourself, here:
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

See: To unsubscribe from wxhaskell-users, get a password reminder, or
change your subscription options enter your subscription email
address".

>
> ------------------------------------------------------------------------------
> Cloud Services Checklist: Pricing and Packaging Optimization
> This white paper is intended to serve as a reference, checklist and point of
> discussion for anyone considering optimizing the pricing and packaging model
> of a cloud services business. Read Now!
> http://www.accelacomm.com/jaw/sfnl/114/51491232/
> _______________________________________________
> wxhaskell-users mailing list
> wxhaskell-users@...
> https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
>

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
David Virebayre | 7 Dec 15:39 2011
Picon

Re: adapt layout after changing 'visible' state



2011/12/6 Henning Thielemann <lemming <at> henning-thielemann.de>

I have a textCtrl 'editor' and a menu item 'editorVisible' that controls
the visibility of the textCtrl.

    set editorVisible
        [ on command := do
             b <- get editorVisible checked
             set editor [ visible := b ] ]

I had the same problem, and I couldn't solve it the way I wanted.
It's old but I think I read that I shouldn't use visible for this, but remove the element from the layout and re-set the modified layout.

David.
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
Henning Thielemann | 8 Dec 14:22 2011
Picon

Re: adapt layout after changing 'visible' state


On Wed, 7 Dec 2011, David Virebayre wrote:

> 2011/12/6 Henning Thielemann <lemming@...>
>
>       I have a textCtrl 'editor' and a menu item 'editorVisible' that controls
>       the visibility of the textCtrl.
>
>           set editorVisible
>               [ on command := do
>                    b <- get editorVisible checked
>                    set editor [ visible := b ] ]
> 
> 
> I had the same problem, and I couldn't solve it the way I wanted.
> It's old but I think I read that I shouldn't use visible for this, but remove the
> element from the layout and re-set the modified layout.

  I got it working by adding 'windowReFit editor' or 'windowReLayout frame' 
after 'set editor [ visible := b ]'.

  I do not know, whether this is intended behaviour or an ugly hack. The 
official example controls.cpp uses a BoxSizer object and its Show method. 
I am uncertain how to translate this to wxhaskell. How do I create a 
BoxSizer object? With boxSizerCreate or sizerFromLayout? How do I add the 
BoxSizer object? By converting it to a Layout using 'sizer'?

  I think the best place for documenting the solution is not the FAQ but 
the documentation of the Visible class.

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
Henning Thielemann | 8 Dec 19:49 2011
Picon

Re: adapt layout after changing 'visible' state


On Thu, 8 Dec 2011, Henning Thielemann wrote:

> I think the best place for documenting the solution is not the FAQ but the 
> documentation of the Visible class.

Here is my proposed patch:

wxhaskell/wx$ darcs2 diff --unified src/Graphics/UI/WX/Classes.hs
--- old-wxhaskell/wx/src/Graphics/UI/WX/Classes.hs      2011-12-08 19:45:56.000000000 +0100
+++ new-wxhaskell/wx/src/Graphics/UI/WX/Classes.hs      2011-12-08 19:45:56.000000000 +0100
 <at>  <at>  -173,6 +173,19  <at>  <at> 
  -- | Visible widgets.
  class Visible w where
    -- | Is the widget visible?
+  --
+  -- If you hide a widget, its space will not immediately
+  -- be filled by other widgets.
+  -- Vice versa if you make a widget visible
+  -- it will not have space to be rendered into.
+  -- That is, when changing the visibility state
+  -- it is advised to update the layout
+  -- using 'Graphics.UI.WX.Layout.windowReFit'.
+  --
+  -- Example:
+  --
+  -- > do set w [ visible := False ]
+  -- >    windowReFit w
    visible    :: Attr w Bool
    -- | Refresh the widget explicitly.
    refresh    :: w -> IO ()

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
Eric Kow | 9 Dec 09:08 2011
Picon

Re: [wxhaskell-users] adapt layout after changing 'visible' state

I'd go ahead and record/send that.

Thanks! This sort of distributed doc effort helps :-)

On 8 Dec 2011, at 18:49, Henning Thielemann wrote:
> Here is my proposed patch:
> 
> wxhaskell/wx$ darcs2 diff --unified src/Graphics/UI/WX/Classes.hs
> --- old-wxhaskell/wx/src/Graphics/UI/WX/Classes.hs      2011-12-08 19:45:56.000000000 +0100
> +++ new-wxhaskell/wx/src/Graphics/UI/WX/Classes.hs      2011-12-08 19:45:56.000000000 +0100
>  <at>  <at>  -173,6 +173,19  <at>  <at> 
>  -- | Visible widgets.
>  class Visible w where
>    -- | Is the widget visible?
> +  --
> +  -- If you hide a widget, its space will not immediately
> +  -- be filled by other widgets.
> +  -- Vice versa if you make a widget visible
> +  -- it will not have space to be rendered into.
> +  -- That is, when changing the visibility state
> +  -- it is advised to update the layout
> +  -- using 'Graphics.UI.WX.Layout.windowReFit'.
> +  --
> +  -- Example:
> +  --
> +  -- > do set w [ visible := False ]
> +  -- >    windowReFit w

--

-- 
Eric Kow <http://erickow.com>

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/

Gmane