From: Vadim Zeitlin Date: Wed, 4 Sep 2013 00:14:25 +0000 (+0000) Subject: Add a test for a tooltip for a control inside a static box. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f1c498821548ba0d1fb916b00328a7622886e115 Add a test for a tooltip for a control inside a static box. 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 --- diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index c319fae203..16e582f203 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -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();