+
+void wxWindowBase::SetContainingSizer(wxSizer* sizer)
+{
+ // adding a window to a sizer twice is going to result in fatal and
+ // hard to debug problems later because when deleting the second
+ // associated wxSizerItem we're going to dereference a dangling
+ // pointer; so try to detect this as early as possible
+ wxASSERT_MSG( !sizer || m_containingSizer != sizer,
+ _T("Adding a window to the same sizer twice?") );
+
+ m_containingSizer = sizer;
+
+ // If there was an initial size for this window, and if a minsize has not
+ // been set, then set the initial size as the minsize. This helps with
+ // sizer layout when a larger than GetBestSize size is needed for
+ // controls.
+ if (m_initialSize != wxDefaultSize && GetMinSize() == wxDefaultSize)
+ SetSizeHints(m_initialSize);
+}
+