wxWebView - Mouse event

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

wxWebView - Mouse event

Post by saifcoder »

How to catch wxWebView mouse click event ?! it's not working.

Code: Select all

MyWEBVIEW = wxWebView::New(...);

MyWEBVIEW->Bind(wxEVT_LEFT_DOWN, &MyWindow::OnMouseLeftDown, this);
// OR
Bind( wxEVT_LEFT_DOWN, &MyWindow::OnMouseLeftDown, this, MyWEBVIEW_ID );

void MyWindow::OnMouseLeftDown(wxMouseEvent& evt){ ... }
Compile fine but I don't receive any events!, did wxWebView support mouse events ?
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView - Mouse event

Post by doublemax »

wxWebView is a wrapper around the native web browser control on each platform, which probably consume the mouse (and maybe other) events.
Use the source, Luke!
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxWebView - Mouse event

Post by evstevemd »

Hi,
saifcoder wrote: Sun Nov 17, 2019 10:57 pm How to catch wxWebView mouse click event ?! it's not working.

Code: Select all

MyWEBVIEW = wxWebView::New(...);

MyWEBVIEW->Bind(wxEVT_LEFT_DOWN, &MyWindow::OnMouseLeftDown, this);
// OR
Bind( wxEVT_LEFT_DOWN, &MyWindow::OnMouseLeftDown, this, MyWEBVIEW_ID );

void MyWindow::OnMouseLeftDown(wxMouseEvent& evt){ ... }
Compile fine but I don't receive any events!, did wxWebView support mouse events ?
I assume you want to change context menu. The procedure would be to disable the current context menu (the default) and create your own. There were issues which I tried to fix in pull request[1] but got no time to finish it. You might want to take from where I ended and finish with VZ review comments

1. https://github.com/wxWidgets/wxWidgets/pull/401
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder »

Got it, thank you guys
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxWebView - Mouse event

Post by evstevemd »

As questions serve as references for the future, it is a good thing to say how you solved it
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder »

evstevemd wrote: Sat Nov 23, 2019 3:56 pm As questions serve as references for the future, it is a good thing to say how you solved it
I love sharing solutions so much, I know how important is, it's just I didn't fix it yet! #-o but I just completely disable the wxWebView to skip all events MyWebView->Enable(false);

I would like catch mouse event click to allow user mouse hover on the WebView but the control eat all events :/

Sincerely,
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder »

by the way, I'm looking if wxWidgets will support Microsoft Web View 2 in the future? [-o<

https://docs.microsoft.com/en-us/micros ... ingstarted
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView - Mouse event

Post by doublemax »

There is a wxWebView backend for Edge, but development has stopped as it's unclear what happens with regards to Microsoft's switch to Chrome.
https://github.com/wxWidgets/wxWidgets/pull/807
Use the source, Luke!
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder »

Oh!, everything made by Microsoft was wonderful, Windows, XBOX, Kinet, Azure, Live, Bing.. except two things that stupidly down to low level! Windows Phone and there web browsers (IE/Edge) ](*,)
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView - Mouse event

Post by ONEEYEMAN »

Hi,
You probably never worked under Unix/Linux?

;-)

Thank you.
Post Reply