-#if wxUSE_GUI
- // Carry on up the parent-child hierarchy, but only if event is a command
- // event: it wouldn't make sense for a parent to receive a child's size
- // event, for example
- if ( m_isWindow && event.IsCommandEvent() )
- {
- wxWindow *win = (wxWindow *)this;
-
- // honour the requests to stop propagation at this window: this is
- // used by the dialogs, for example, to prevent processing the events
- // from the dialog controls in the parent frame which rarely, if ever,
- // makes sense
- if ( !(win->GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
- {
- wxWindow *parent = win->GetParent();
- if ( parent && !parent->IsBeingDeleted() )
- return parent->GetEventHandler()->ProcessEvent(event);
- }
- }
-#endif // wxUSE_GUI
-
- // Last try - application object.
- if ( wxTheApp && (this != wxTheApp) )
- {
- // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
- // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be
- // processed appropriately via SearchEventTable.
- if ( event.GetEventType() != wxEVT_IDLE )
- {
- if ( wxTheApp->ProcessEvent(event) )
- return TRUE;
- }
- }
-
- return FALSE;
+ // Finally propagate the event upwards the window chain and/or to the
+ // application object as necessary
+ return TryParent(event);