]> git.saurik.com Git - wxWidgets.git/commitdiff
Create wxStaticBoxSizer elements as children of wxStaticBox in XRC.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 30 Jun 2012 16:33:10 +0000 (16:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 30 Jun 2012 16:33:10 +0000 (16:33 +0000)
As we now recommend creating the controls shown inside wxStaticBox as its
children, and not siblings, follow our own recommendation by doing just this
in XRC handler of wxStaticBoxSizer.

Also add a test of using a tooltip with a wxStaticBoxSizer element to the XRC
demo showing that tooltips do work now for them, unlike before.

Closes #14431.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/xrc/rc/objref.xrc
src/xrc/xh_sizer.cpp

index 03876e6a987415f722c62f63e2e8023c96e1055a..7028045d69d54c1bb507dc573401bd493fcd813e 100644 (file)
@@ -80,6 +80,7 @@
                             <object class="sizeritem">
                               <object class="wxStaticBitmap" name="first_row[0]">
                                 <bitmap>update.gif</bitmap>
+                                <tooltip>See the tooltip!</tooltip>
                               </object>
                             </object>
                             <object class="sizeritem">
index 9e3d23d2ffc4f5fbfc031d88dd31e3af2df85cee..6a7e591bb37562a17f7bc629de4d5196b52b1438 100644 (file)
@@ -256,7 +256,16 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
     m_isInside = true;
     m_isGBS = (m_class == wxT("wxGridBagSizer"));
 
-    CreateChildren(m_parent, true/*only this handler*/);
+    wxObject* parent = m_parent;
+#if wxUSE_STATBOX
+    // wxStaticBoxSizer's child controls should be parented by the box itself,
+    // not its parent.
+    wxStaticBoxSizer* const stsizer = wxDynamicCast(sizer, wxStaticBoxSizer);
+    if ( stsizer )
+        parent = stsizer->GetStaticBox();
+#endif // wxUSE_STATBOX
+
+    CreateChildren(parent, true/*only this handler*/);
 
     // set growable rows and cols for sizers which support this
     if ( wxFlexGridSizer *flexsizer = wxDynamicCast(sizer, wxFlexGridSizer) )