Hi friends,

I have a custom tree control(Tree control) and a check list box placed next to each other on a frame.i.e., tree control on the left side of the frame and check list box on the right.

I need to place sizers such that on exapnsion of the frame, the tree control should only increase in vertical direction and the check list box should should increase in size both in the horizontal and vertical directions.

Currently : THe custom tree control is GETTING placed above the checklist box control after implementing sizers.

Please check the attachments.
Please help!!!....

Regards,
Dinil

you can use such flags as

wx.TOP
wx.BOTTOM
wx.LEFT
wx.RIGHT

#Here is an example
self.sizer.Add(self.Tree,proportion=1,flag = wx.TOP|wx.BOTTOM)
#Now that would only expand top and botton
# I cant remember if you need wx.EXPAND in there too....

to tell the sizers which ways it is allowed to expand.

I think Paul is right but cannot give 100% vote until I test it! If you post simple piece of code, it will be easy to play with code and re-post it modified; but if your codes are not closed source anyway!

This are the sizers I am using...

hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
hsizer2 = wx.FlexGridSizer(cols=1, hgap=5, vgap=5)
hsizer2.AddGrowableCol(0)

hsizer2.Add(self.customTree,1,wx.EXPAND | wx.ALIGN_LEFT,2)
hsizer2.Add(self.chkLstBox, 1,wx.EXPAND | wx.ALIGN_RIGHT,2)

b = 5
vsizer2 = wx.BoxSizer(wx.VERTICAL)
vsizer2.Add(hsizer2, 1, wx.EXPAND | wx.ALL, b)

self.SetSizer(vsizer2)
#get the size of the main frame
r = self.GetSize()
#set the minimal size of the main frame
self.SetMinSize(r)
self.CenterOnScreen()

With the above piece of code, the tree control and check list box are being place one above the other(See attachment). But I want them to be placed next to each other.

Please help!!!

Regards,
Dinil

Why are you using a flex Grid Sizer? You could do exactly what you want with just a wx.Sizer.

Thanks a lot... It's working now....
I removed the FlexGrid Sizer.....

Thanks again...

Regards,
Dinil

I also suggest that you give tree a proportion of 0 and the list box 1 so that only list box will expand to fill whole space and the tree will just take optimum space

But IMO

Remember to mark the post as solved if you have solved your problem! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.