]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/widgets.cpp
Don't cast with G_OBJECT when passing a GObject to g_object_ref, g_object_unref and...
[wxWidgets.git] / samples / widgets / widgets.cpp
index 9c46759a463f5c0b853bcbe95d4ba34ef8155482..3473a56c9f97cd699c4ac9476e3136a93c13d021 100644 (file)
@@ -448,7 +448,7 @@ void WidgetsFrame::InitBook()
         menuPages->AppendRadioItem
                    (
                     Widgets_GoToPage + nPage,
-                    wxString::Format("%s\tF%u",
+                    wxString::Format(wxT("%s\tF%u"),
                                      info->GetLabel().c_str(), nPage + 1)
                    );
     }
@@ -513,34 +513,26 @@ void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event))
 {
     static wxString s_tip = _T("This is a tooltip");
 
-    wxString s = wxGetTextFromUser
-                 (
-                    _T("Tooltip text: "),
-                    _T("Widgets sample"),
-                    s_tip,
-                    this
-                 );
+    wxTextEntryDialog dialog
+                      (
+                        this,
+                        _T("Tooltip text (may use \\n, leave empty to remove): "),
+                        _T("Widgets sample"),
+                        s_tip
+                      );
 
-    if ( s.empty() )
+    if ( dialog.ShowModal() != wxID_OK )
         return;
 
-    s_tip = s;
-
-    if( wxMessageBox( _T("Test multiline tooltip text?"),
-                      _T("Widgets sample"),
-                      wxYES_NO,
-                      this
-                    ) == wxYES )
-    {
-        s = _T("#1 ") + s_tip + _T("\n") + _T("#2 ") + s_tip;
-    }
+    s_tip = dialog.GetValue();
+    s_tip.Replace(_T("\\n"), _T("\n"));
 
     WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
-    page->GetWidget()->SetToolTip(s);
+    page->GetWidget()->SetToolTip(s_tip);
 
     wxControl *ctrl2 = page->GetWidget2();
     if ( ctrl2 )
-        ctrl2->SetToolTip(s);
+        ctrl2->SetToolTip(s_tip);
 }
 
 #endif // wxUSE_TOOLTIPS