Add logging of context menu events to the widgets sample
Show when (and if) they are generated.
This commit is contained in:
@@ -227,6 +227,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void OnWidgetFocus(wxFocusEvent& event);
|
void OnWidgetFocus(wxFocusEvent& event);
|
||||||
|
void OnWidgetContextMenu(wxContextMenuEvent& event);
|
||||||
|
|
||||||
void ConnectToWidgetEvents();
|
void ConnectToWidgetEvents();
|
||||||
|
|
||||||
@@ -716,6 +717,8 @@ void WidgetsFrame::ConnectToWidgetEvents()
|
|||||||
|
|
||||||
w->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
w->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||||
w->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
w->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
|
||||||
|
|
||||||
|
w->Bind(wxEVT_CONTEXT_MENU, &WidgetsFrame::OnWidgetContextMenu, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1246,6 +1249,17 @@ void WidgetsFrame::OnWidgetFocus(wxFocusEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WidgetsFrame::OnWidgetContextMenu(wxContextMenuEvent& event)
|
||||||
|
{
|
||||||
|
wxWindow* win = (wxWindow*)event.GetEventObject();
|
||||||
|
wxLogMessage("Context menu event for %s at %dx%d",
|
||||||
|
win->GetClassInfo()->GetClassName(),
|
||||||
|
event.GetPosition().x,
|
||||||
|
event.GetPosition().y);
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// WidgetsPageInfo
|
// WidgetsPageInfo
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user