Update handling and documentation for new window events. Clarify that you must handle the event if you require an action, the default is for nothing to happen.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-25 13:23:05 +00:00
parent 205defae89
commit d676fb218d
2 changed files with 10 additions and 14 deletions

View File

@@ -155,8 +155,8 @@ public:
precise error message/code. precise error message/code.
@event{EVT_WEB_VIEW_NEWWINDOW(id, func)} @event{EVT_WEB_VIEW_NEWWINDOW(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new
window is created. This event may be vetoed to prevent a new window showing, window is created. You must handle this event if you want anything to
for example if you want to open the url in the existing window or a new tab. happen, for example to load the page in a new window or tab.
@endEventTable @endEventTable
@library{wxweb} @library{wxweb}
@@ -519,8 +519,8 @@ public:
precise error message/code. precise error message/code.
@event{EVT_WEB_VIEW_NEWWINDOW(id, func)} @event{EVT_WEB_VIEW_NEWWINDOW(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new
window is created. This event may be vetoed to prevent a new window showing, window is created. You must handle this event if you want anything to
for example if you want to open the url in the existing window or a new tab. happen, for example to load the page in a new window or tab.
@endEventTable @endEventTable
@library{wxweb} @library{wxweb}
@@ -549,8 +549,7 @@ public:
/** /**
Get whether this event may be vetoed (stopped/prevented). Only Get whether this event may be vetoed (stopped/prevented). Only
meaningful for events fired before navigation takes place or new meaningful for events fired before navigation takes place.
window events.
*/ */
bool CanVeto() const; bool CanVeto() const;
@@ -562,8 +561,7 @@ public:
/** /**
Veto (prevent/stop) this event. Only meaningful for events fired Veto (prevent/stop) this event. Only meaningful for events fired
before navigation takes place or new window events. Only valid before navigation takes place. Only valid if CanVeto() returned true.
if CanVeto() returned true.
*/ */
void Veto(); void Veto();
}; };

View File

@@ -956,12 +956,10 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
//If we veto the event then we cancel the new window //We always cancel this event otherwise an Internet Exporer window
if (event.IsVetoed()) //is opened for the url
{ wxActiveXEventNativeMSW* nativeParams = evt.GetNativeParameters();
wxActiveXEventNativeMSW* nativeParams = evt.GetNativeParameters(); *V_BOOLREF(&nativeParams->pDispParams->rgvarg[3]) = VARIANT_TRUE;
*V_BOOLREF(&nativeParams->pDispParams->rgvarg[3]) = VARIANT_TRUE;
}
break; break;
} }
} }