]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a test for a tooltip for a control inside a static box.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 Sep 2013 00:14:25 +0000 (00:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 4 Sep 2013 00:14:25 +0000 (00:14 +0000)
Also create the controls as children of the static box, not its siblings, to
make the tooltip work under wxGTK and because this is how we recommend doing
things now.

See #9859.

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

samples/widgets/static.cpp

index c319fae203ed0c57ae4d083b16dc6b4f7a7e0096..16e582f20300a30cf54601654ba9e4f8e6709c34 100644 (file)
@@ -477,12 +477,12 @@ void StaticWidgetsPage::CreateStatic()
 
     if ( m_chkGeneric->GetValue() )
     {
-        m_statText = new wxGenericStaticText(this, wxID_ANY,
+        m_statText = new wxGenericStaticText(staticBox, wxID_ANY,
                                              m_textLabel->GetValue(),
                                              wxDefaultPosition, wxDefaultSize,
                                              flagsDummyText);
 #if wxUSE_MARKUP
-        m_statMarkup = new wxGenericStaticText(this, wxID_ANY,
+        m_statMarkup = new wxGenericStaticText(staticBox, wxID_ANY,
                                              wxString(),
                                              wxDefaultPosition, wxDefaultSize,
                                              flagsText);
@@ -490,18 +490,20 @@ void StaticWidgetsPage::CreateStatic()
     }
     else // use native versions
     {
-        m_statText = new wxStaticText(this, wxID_ANY,
+        m_statText = new wxStaticText(staticBox, wxID_ANY,
                                       m_textLabel->GetValue(),
                                       wxDefaultPosition, wxDefaultSize,
                                       flagsDummyText);
 #if wxUSE_MARKUP
-        m_statMarkup = new wxStaticText(this, wxID_ANY,
+        m_statMarkup = new wxStaticText(staticBox, wxID_ANY,
                                         wxString(),
                                         wxDefaultPosition, wxDefaultSize,
                                         flagsText);
 #endif // wxUSE_MARKUP
     }
 
+    m_statText->SetToolTip("Tooltip for a label inside the box");
+
 #if wxUSE_MARKUP
     m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
 
@@ -510,20 +512,20 @@ void StaticWidgetsPage::CreateStatic()
 #endif // wxUSE_MARKUP
 
 #if wxUSE_STATLINE
-    m_statLine = new wxStaticLine(this, wxID_ANY,
+    m_statLine = new wxStaticLine(staticBox, wxID_ANY,
                                   wxDefaultPosition, wxDefaultSize,
                                   isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL);
 #endif // wxUSE_STATLINE
 
-    m_sizerStatBox->Add(m_statText, 1, wxGROW | wxALL, 5);
+    m_sizerStatBox->Add(m_statText, 0, wxGROW | wxALL, 5);
 #if wxUSE_STATLINE
     m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5);
 #endif // wxUSE_STATLINE
 #if wxUSE_MARKUP
-    m_sizerStatBox->Add(m_statMarkup, 1, wxGROW | wxALL, 5);
+    m_sizerStatBox->Add(m_statMarkup, 0, wxALL, 5);
 #endif // wxUSE_MARKUP
 
-    m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW);
+    m_sizerStatic->Add(m_sizerStatBox, 0, wxGROW);
 
     m_sizerStatic->Layout();