-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
WinForms - Add LifeSpanHandler implementation capable of hosting popups as Tabs/Controls #3529
WinForms - Add LifeSpanHandler implementation capable of hosting popups as Tabs/Controls #3529
Conversation
Example of the new API: browser.LifeSpanHandler = CefSharp.WinForms.Handler.LifeSpanHandler
.Create()
.OnPopupCreated((ctrl, targetUrl) =>
{
//Add popup to new parent control e.g. Tab
parent.Controls.Add(ctrl);
})
.OnPopupDestroyed((ctrl, popupBrowser) =>
{
//If browser is disposed or the handle has been released then we don't
//need to remove the tab (likely removed from menu)
if (!ctrl.IsDisposed && ctrl.IsHandleCreated)
{
parent.Controls.Remove(ctrl);
}
}).Build(); |
✅ Build CefSharp 90.5.30-CI4020 completed (commit 68d3964199 by @amaitland) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tweaks required.
✅ Build CefSharp 90.5.30-CI4022 completed (commit f88dfa6395 by @amaitland) |
6986557
to
4a331bc
Compare
✅ Build CefSharp 91.1.10-CI4024 completed (commit 604c6193eb by @amaitland) |
✅ Build CefSharp 91.1.10-CI4025 completed (commit 4947487651 by @amaitland) |
Consider switching from Action to strongly typed delegates. Change the fluent method names. |
…ps as Tabs/Child controls in WinForms - Update Example - Remove PopupAsChildHelper and example LifeSpanHandler - Examples always opens popups as tabs now.
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
- Rename OnPopupCreated to RegisterPopupCreated - Rename OnPopupDestroyed to RegisterPopupDestroyed - Improve xml doc and comments
- Make ParentFormMessageInterceptor public - Make ChromiumHostControl public, move into CefSharp.WinForms.Host namespace Rather than having the class in the CefSharp.WinForms namespace and potentially confuse users, move into it's own namespace.
- Code cleanup - Improve comments
676386e
to
e82331f
Compare
…ps as Tabs/Controls (#3529) * WinForms - Add LifeSpanHandler implementation capable of hosting popups as Tabs/Child controls in WinForms - Update Example - Remove PopupAsChildHelper and example LifeSpanHandler - Examples always opens popups as tabs now. - Improve xml doc and comments - Make ParentFormMessageInterceptor public - Make ChromiumHostControl public, move into CefSharp.WinForms.Host namespace Rather than having the class in the CefSharp.WinForms namespace and potentially confuse users, move into it's own namespace. - Clarify ShowDevToolsDocked needs to be used with the new WinForms lifespan handler
Summary:
Opening popups as Tabs is a fairly common scenario and requires extra plumbing currently.
This adds a LifeSpanHandler capable of hosting popups as Tabs/Sub Controls.
Changes:
How Has This Been Tested?
Types of changes
Checklist: