can you please help me regarding Sizer Problem

hi All

can anybody tell me how to hide sizer.

I have creted one window x under that
sizer s.

i m trying hide this sizer by using

s->Show(s,FALSE);

s->Layout();

but still its displaying me its children
component(slider,button).

thanks

amit tandial

*********************** Aricent-Unclassified ***********************

"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."

Hi,

hi All
can anybody tell me how to hide sizer.

I have creted one window x under that sizer s.
i m trying hide this sizer by using

s->Show(s,FALSE);
s->Layout();

but still its displaying me its children component(slider,button).

A sizer just controls the layout of things, it will not hide the items/controls it is laying out. So you would have to do something like this:

slider.Hide()
buttton.Hide()
sizer.Hide()
sizersparent.Layout()

Werner

···

Amit15.Kumar@aricent.com wrote:

You can't hide a sizer.
If you want to hide several items at once, you should put them all on a panel, put your sizer on the panel and the controls on the sizer.

Then, when you hide the panel, all of your controls will dissapear.

And you should call Layout for the parent window of the panel so it could rearrange itself to hide it.

···

Amit15.Kumar@aricent.com wrote:

hi All
can anybody tell me how to hide sizer.

I have creted one window x under that sizer s.
i m trying hide this sizer by using

s->Show(s,FALSE);
s->Layout();

but still its displaying me its children component(slider,button).

thanks
amit tandial

*********************** Aricent-Unclassified ***********************

"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."

are you sure? Here is an example that demonstrates the contrary. It works on Windows.

import wx

class TestFrame(wx.Frame):
def init(self):

    wx.Frame.__init__(self, None, title="Hide Sizer Example")
    self.b1 =wx.Button(self, label = "Hide ninja, hide!")
    self.b2 =wx.Button(self, label = "A regular, black claded ninja")

    self.box1  =wx.BoxSizer(wx.VERTICAL)
    self.box2  =wx.BoxSizer(wx.VERTICAL)
    self.box1.Add(self.b1, 1, wx.EXPAND|wx.ALL, 10)
    self.box2.Add(self.b2, 1, wx.EXPAND)
    self.box1.Add

(self.box2, 1, wx.EXPAND|wx.ALL, 10)
self.SetSizer(self.box1)
self.b1.Bind(wx.EVT_BUTTON, self.ThrowSmoke)
self.Show()

def ThrowSmoke(self, evt):
    self.box1.Hide

(self.box2) #the outer box sizer hides the inner box sizer
self.b1.SetLabel(“Pooof… no more ninja”)
self.box1.Layout() #if you don’t add this line the ninja will continue to distort the reality field and will be detectable by the space it dislocates :wink:

app = wx.App(0)
TestFrame()
app.MainLoop()

···

On 2/8/07, Eli Golovinsky gooli@tuzig.com wrote:

You can’t hide a sizer.


There is NO FATE, we are the creators.

Of course you can:

wxSizer::Hide
bool Hide(wxWindow* window, bool recursive = false)

==> bool Hide(wxSizer* sizer, bool recursive = false) <==

bool Hide(size_t index)

Hides the window, sizer, or item at index. To make a sizer item
disappear, use Hide() followed by Layout(). Use parameter recursive to
hide elements found in subsizers.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 2/8/07, Eli Golovinsky <gooli@tuzig.com> wrote:

You can't hide a sizer.

Damn...
I'm absolutely sure I tried that once and it didn't work.

Well, I stand corrected then.

Thanks.

Peter Damoc wrote:

···

On 2/8/07, *Eli Golovinsky* <gooli@tuzig.com <mailto:gooli@tuzig.com>> > wrote:

    You can't hide a sizer.

are you sure? Here is an example that demonstrates the contrary. It works on Windows.

import wx

class TestFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title="Hide Sizer Example")
        self.b1 =wx.Button(self, label = "Hide ninja, hide!")
        self.b2 =wx.Button(self, label = "A regular, black claded ninja")
        self.box1 =wx.BoxSizer(wx.VERTICAL)
        self.box2 =wx.BoxSizer(wx.VERTICAL)
        self.box1.Add(self.b1, 1, wx.EXPAND|wx.ALL, 10)
        self.box2.Add(self.b2, 1, wx.EXPAND)
        self.box1.Add (self.box2, 1, wx.EXPAND|wx.ALL, 10)
        self.SetSizer(self.box1)
        self.b1.Bind(wx.EVT_BUTTON, self.ThrowSmoke)
        self.Show()
           def ThrowSmoke(self, evt):
        self.box1.Hide (self.box2) #the outer box sizer hides the inner box sizer
        self.b1.SetLabel("Pooof... no more ninja")
        self.box1.Layout() #if you don't add this line the ninja will continue to distort the reality field and will be detectable by the space it dislocates :wink:
   
       app = wx.App(0)
TestFrame()
app.MainLoop()

--
There is NO FATE, we are the creators.

Eli Golovinsky wrote:

Damn...
I'm absolutely sure I tried that once and it didn't work.

Well, I stand corrected then.

I just have to join you - was sure too that one had to hide the controls or at least the parent panel :-[

Thanks Peter and Andrea
Werner

Werner F. Bruhin wrote:

Eli Golovinsky wrote:

Damn...
I'm absolutely sure I tried that once and it didn't work.

Well, I stand corrected then.

I just have to join you - was sure too that one had to hide the controls or at least the parent panel :-[

That used to be true, but I think sizer.Show/Hide was added in 2.5.x or so.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!