+#if wxUSE_HELP
+
+void MyFrame::OnContextHelp(wxCommandEvent& WXUNUSED(event))
+{
+ // launches local event loop
+ wxContextHelp ch( this );
+}
+
+#endif // wxUSE_HELP
+
+void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const
+{
+ if( (flags & flag) == flag )
+ {
+ if( !flagStr.empty() )
+ flagStr += _T(" | ");
+ flagStr += flagName;
+ }
+}
+
+void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
+{
+ wxBookCtrlBase * book = GetCurrentBook();
+ const wxPoint pt = ::wxGetMousePosition();
+
+ long flags;
+ int pagePos = book->HitTest( book->ScreenToClient(pt), &flags );
+
+ wxString flagsStr;
+
+ AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, _T("wxBK_HITTEST_NOWHERE") );
+ AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, _T("wxBK_HITTEST_ONICON") );
+ AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, _T("wxBK_HITTEST_ONLABEL") );
+ AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, _T("wxBK_HITTEST_ONPAGE") );
+
+ wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"),
+ pt.x,
+ pt.y,
+ pagePos,
+ flagsStr.c_str());
+}
+