- if (dialog.ShowModal() == wxID_OK)
- {
- wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
- dialog2.ShowModal();
- }
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
+ dialog2.ShowModal();
+ }
+}
+
+void MyFrame::ShowTip(wxCommandEvent& event)
+{
+#if wxUSE_STARTUP_TIPS
+ static size_t s_index = (size_t)-1;
+
+ if ( s_index == (size_t)-1 )
+ {
+ srand(time(NULL));
+
+ // this is completely bogus, we don't know how many lines are there
+ // in the file, but who cares, it's a demo only...
+ s_index = rand() % 5;
+ }
+
+ wxTipProvider *tipProvider = wxCreateFileTipProvider("tips.txt", s_index);
+
+ bool showAtStartup = wxShowTip(this, tipProvider);
+
+ if ( showAtStartup )
+ {
+ wxMessageBox("Will show tips on startup", "Tips dialog",
+ wxOK | wxICON_INFORMATION, this);
+ }
+
+ s_index = tipProvider->GetCurrentTip();
+ delete tipProvider;
+#endif