Closed sxmxta closed 7 months ago
Thanks for reporting this issue! :)
I just uploaded the fix and a modified CookieManager demo for Lazarus showing how to add a custom context menu item.
TCoreWebView2ContextMenuItem now adds and removes the browser events correctly.
Notice how the custom menu item is only created once because custom items should be reused whenever possible.
This is a closer code translation of the official code snippet.
Hello. I encountered an issue using the custom right-click menu callback event "ContextMenuRequested" in Lazarus. When setting the menu item to select an event proxy object, it causes the browser object (WVBrowser1) address to become invalid. critical code: Current browser object:
TempMenuItem.AddCustomItemSelectedEvent(WVBrowser1);
Temporary copy:
TempMenuItem.AddCustomItemSelectedEvent(WVBrowser2);
Operation steps: After the program runs.
The reproduction method of this problem can be repeatedly found by right clicking on the browser window, clicking a button, or switching windows
The current temporary solution is to create another TWVBrowser object and only handle the Custom Item Selected event.
Code change from CookieManager example
First run display window:
No feedback from the window after right clicking:
The window is stuck: