On Wed, 31 Jan 2024 11:04:07 +0100 Raphael Stonehorse wrote:
RS> Hi!
RS>
RS> I've added in the WebFrame::WebFrame constructor in the webview sample:
RS>
RS>
https://github.com/wxWidgets/wxWidgets/blob/WX_3_0_BRANCH/samples/webview/webview.cpp
RS>
RS> the following event binding:
RS>
RS> panel->Bind(wxEVT_LEFT_UP, [&](wxMouseEvent& event) {
RS> wxMessageBox(wxString::Format("The frame is clicked at {x=%d,
RS> y=%d}", event.GetPosition().x, event.GetPosition().y), "FrameClick",
RS> wxID_ANY) ;
RS> std::cout << event.GetPosition().x << " , " <<
RS> event.GetPosition().y << std::endl;
RS> mouse_position = event.GetPosition();
RS> });
RS>
RS> But I do not get any output
RS>
RS> What am I doing wrong? How to make it work?
One thing you're definitely doing wrong is that you're binding to the
mouse event on the panel but the panel is never going to get it, being
entirely covered by wxWebView as it probably is. You should bind to the web
view itself.
But generally speaking, I'd probably recommend handling mouse events in
wxWebView using JS and not wx itself as this should be more generally more
robust.
Good luck,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/