Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Review: DragStarting Event API #4900

Merged
merged 9 commits into from
Nov 13, 2024
Prev Previous commit
Next Next commit
Addressing feedback
  • Loading branch information
johna-ms committed Oct 30, 2024
commit 042c2b4130657184c76d67d84d10fcd3d7e7654a
8 changes: 6 additions & 2 deletions specs/DragStarting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ to start their own drag. Notably the `Deferral` can be used to execute any async
drag logic and call back into the WebView at a later time. The `Handled`
property lets the WebView2 know whether to exercise its own drag logic or not.

## Override drag and drop
```C++
// Using DragStarting to simply make a synchronous DoDragDrop call instead of
// having WebView2 do it.
Expand Down Expand Up @@ -67,7 +68,10 @@ CHECK_FAILURE(m_compController5->add_DragStarting(
})
.Get(),
&m_dragStartingToken));
```

## Disable drag and drop
```C++
// Using DragStarting to no-op a drag operation.
CHECK_FAILURE(m_compController5->add_DragStarting(
Callback<ICoreWebView2DragStartingEventHandler>(
Expand All @@ -76,7 +80,7 @@ CHECK_FAILURE(m_compController5->add_DragStarting(
{
// If the event is marked handled, WebView2 will not execute its
// drag logic.
args->put_Handled(m_dragOverrideMode == DragOverrideMode::NOOP);
args->put_Handled(TRUE);
return S_OK;
})
.Get(),
Expand Down Expand Up @@ -125,7 +129,7 @@ interface ICoreWebView2DragStartingEventArgs : IUnknown {
/// Indicates whether this event has been handled by the app. If the
/// app handles this event, WebView2 will not initiate drag drop. If
/// the app does not handle the event, WebView2 will initiate its own
/// drag drop logic.
/// drag drop logic. The default value is FALSE.
[propput] HRESULT Handled([in] BOOL value);


Expand Down