Merge pull request #859 from tianzhuqiao/agw_aui_4.0.x

Detach wxControl in AuiToolbar from current sizer before attach to a …
(cherry picked from commit 02041bccb3)
This commit is contained in:
Robin Dunn
2018-05-17 15:51:13 -07:00
parent 1c61d066a4
commit 466a3118ce
2 changed files with 5 additions and 0 deletions

View File

@@ -134,6 +134,8 @@ Changes in this release include the following:
* Detach wxControl in AuiToolbar from current sizer before attach to a new one.
(#843)
4.0.1 "Lemonade"
----------------

View File

@@ -3072,6 +3072,9 @@ class AuiToolBar(wx.Control):
sizer_item = sizer.Add((item.spacer_pixels, 1))
elif kind == ITEM_CONTROL:
if item.window and item.window.GetContainingSizer():
# Make sure that there is only one sizer to this control
item.window.GetContainingSizer().Detach(item.window);
vert_sizer = wx.BoxSizer(wx.VERTICAL)
vert_sizer.AddStretchSpacer(1)