+// the current depth of the stack used by Push/PopStatusText()
+static int gs_depth = 0;
+
+void MyFrame::OnPushStatusText(wxCommandEvent& WXUNUSED(event))
+{
+ wxStatusBar *sb = GetStatusBar();
+ if (!sb)
+ return;
+
+ static int s_countPush = 0;
+ sb->PushStatusText(wxString::Format
+ (
+ "Pushed message #%d (depth = %d)",
+ ++s_countPush, ++gs_depth
+ ), m_field);
+}
+
+void MyFrame::OnPopStatusText(wxCommandEvent& WXUNUSED(event))
+{
+ wxStatusBar *sb = GetStatusBar();
+ if (!sb)
+ return;
+
+ if ( !gs_depth )
+ {
+ wxLogStatus("No message to pop.");
+ return;
+ }
+
+ gs_depth--;
+ sb->PopStatusText(m_field);
+}
+