resize TextCtrl and panel

I am trying to make a hide/show button to resizes 2 TextCtrls and have
the other TextCtrls expand to fill in the available space. - I have
the resize working, but not the expand.

         stdout = wx.TextCtrl(
                 panel_cr, style=wx.TE_READONLY|wx.TE_MULTILINE)
         stdout.SetSizerProps(proportion=1, expand=True)

def Detail(self,event)
        if self.detail:
            # squish - remove detail from display
            size=(-1,20)
        else:
            # restore to normal size - show detail on display
            size=(-1,-1)

        self.stdout.SetMaxSize(size)
        self.stderr.SetMaxSize(size)

        parent=self.panel_cr.GetTopLevelParent()
        parent.SendSizeEvent()

        # flip state for next time
        self.detail = not self.detail

I have it kinda working by leaving the TextCtrl alone and changing the
panel's proportion, but that only kinda works most of the time, and
basically breaks when I try to shrink all of them, because then all
proportion's are the same, so they all expand. What should happen in
the case of all shrunk is all are small and a bunch of unused space
appears at the bottom of the outer panel.

You can see the kinda working here:

https://github.com/CarlFK/dvsmon/blob/master/dvs-mon.py#L148

So how do I make this work 'right' ?

···

--
Carl K

It sounds like there are more controls on the panel other than the two textctrls in question, is that right? I'll describe how I've done something similar to this with 2 widgets where one or neither can be hidden and you can extrapolate that up to your situation with 2 that can be hidden and others that will always be visible... Basically I just added both widgets to the box sizer with a proportion=1, then when one of them is to be hidden I call its Hide() and then call the parent window's Layout() and the sizer will ignore the hidden one and give all available free space to the visible widget. When I need to show both I use Show and then Layout again and the sizer will divide the free space between them.

···

On 10/30/11 12:59 PM, Carl Karsten wrote:

I am trying to make a hide/show button to resizes 2 TextCtrls and have
the other TextCtrls expand to fill in the available space. - I have
the resize working, but not the expand.

          stdout = wx.TextCtrl(
                  panel_cr, style=wx.TE_READONLY|wx.TE_MULTILINE)
          stdout.SetSizerProps(proportion=1, expand=True)

  def Detail(self,event)
         if self.detail:
             # squish - remove detail from display
             size=(-1,20)
         else:
             # restore to normal size - show detail on display
             size=(-1,-1)

         self.stdout.SetMaxSize(size)
         self.stderr.SetMaxSize(size)

         parent=self.panel_cr.GetTopLevelParent()
         parent.SendSizeEvent()

         # flip state for next time
         self.detail = not self.detail

I have it kinda working by leaving the TextCtrl alone and changing the
panel's proportion, but that only kinda works most of the time, and
basically breaks when I try to shrink all of them, because then all
proportion's are the same, so they all expand. What should happen in
the case of all shrunk is all are small and a bunch of unused space
appears at the bottom of the outer panel.

--
Robin Dunn
Software Craftsman