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: 70
Joined: Thu Nov 16, 2017 9:32 pm

wxWebView - Mouse event

Post by saifcoder » 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 ?
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

User avatar
doublemax
Moderator
Moderator
Posts: 14621
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView - Mouse event

Post by doublemax » Sun Nov 17, 2019 11:00 pm

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: 2292
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxWebView - Mouse event

Post by evstevemd » Mon Nov 18, 2019 5:54 am

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?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder » Sat Nov 23, 2019 12:21 pm

Got it, thank you guys
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2292
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxWebView - Mouse event

Post by evstevemd » 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
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?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder » Sun Nov 24, 2019 3:31 pm

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.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder » Sun Nov 24, 2019 3:34 pm

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.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

User avatar
doublemax
Moderator
Moderator
Posts: 14621
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView - Mouse event

Post by doublemax » Sun Nov 24, 2019 3:43 pm

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: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView - Mouse event

Post by saifcoder » Sun Nov 24, 2019 3:57 pm

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.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3902
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView - Mouse event

Post by ONEEYEMAN » Sun Nov 24, 2019 8:44 pm

Hi,
You probably never worked under Unix/Linux?

;-)

Thank you.

Post Reply