+void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
+{
+#if wxUSE_ANIMATIONCTRL
+ // get the pointers we need
+ wxButton *btn = wxDynamicCast(event.GetEventObject(), wxButton);
+ if (!btn || !btn->GetParent()) return;
+
+ wxWindow *win = btn->GetParent();
+ wxAnimationCtrl *ctrl = XRCCTRL(*win, "controls_animation_ctrl", wxAnimationCtrl);
+ if (ctrl->IsPlaying())
+ {
+ ctrl->Stop();
+ btn->SetLabel(wxT("Play"));
+ }
+ else
+ {
+ if (ctrl->Play())
+ btn->SetLabel(wxT("Stop"));
+ else
+ wxLogError(wxT("Cannot play the animation..."));
+ }
+#endif
+}