Forwarding child events to a top level window
Randy Sales
randy.sales at impinj.com
Thu Aug 2 09:21:53 PDT 2007
I need to forward an event from a child window/control to the main/top
window of my application and I've been unable to find a description of
how to do this. I'm currently planning to do this in the event handler
for the child control:
void CEmVirtualViewTreeCtrl::OnVirtualRetrieve( wxCommandEvent& event )
{
// First get a pointer the the data I need to forward with the
command
wxTreeItemId pItem = GetSelection( );
CEmVirtualTreeItemData* pItemData = (CEmVirtualTreeItemData
*)GetItemData( pItem );
// Now store the address of the data in the event object
event.SetClientData( pItemData->m_pItem );
// Finally, forward the event to the main window
wxWindow * pMainWindow = wxGetApp().GetTopWindow();
pMainWindow->GetEventHandler()->ProcessEvent( event );
}
Two questions:
1) Is this the appropriate way to forward a child event to a main
window?
2) Are there any issues with attaching a data object to the event,
as I have done in this example?
Thanks,
Randy Sales
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20070802/21cb8b9e/attachment.htm
More information about the wx-users
mailing list