Page 1 of 1

middle mouse button

Posted: Mon Sep 14, 2020 9:39 pm
by kotyara
How to assign your own action to the middle mouse button click?

Re: middle mouse button

Posted: Tue Sep 15, 2020 8:40 am
by salvadordf
If you're using a browser in "normal" mode then try intercepting the Windows message using the TChromium.OnRenderCompMsg event.

If your application uses the OSR mode then all you have to do is implement your code in the OnMouseUp or OnMouseDown events of the buffer panel.

Re: middle mouse button

Posted: Tue Sep 15, 2020 12:45 pm
by kotyara
How do I know which Chromium triggered this event?

Re: middle mouse button

Posted: Tue Sep 15, 2020 1:13 pm
by salvadordf
In case of OSR browsers you should have a one to one relation between a buffer panel and a TCromium component.
If you get a OnMouseDown event in that buffer panel then you know it's related to the only browser using that panel.

Re: middle mouse button

Posted: Tue Sep 15, 2020 1:28 pm
by kotyara
I'm trying to do this:

Code: Select all

Chromium->OnRenderCompMsg = RenderCompMsg;

Code: Select all

void __fastcall TForm1::RenderCompMsg(Winapi::Messages::TMessage &aMessage, bool &aHandled){
	if(aMessage.Msg==WM_MBUTTONDOWN){
		aHandled = true;
		// ??? 
	}
}
But I don't understand how to understand what Chromium it caused =(

Re: middle mouse button

Posted: Tue Sep 15, 2020 2:17 pm
by salvadordf
Sorry. I though you were using the OSR mode.

In normal mode you would assign a different procedure to handle the OnRenderCompMsg event of each browser.
I see now that I should add a "Sender" parameter to those events to make this easier.

Re: middle mouse button

Posted: Tue Sep 15, 2020 2:39 pm
by salvadordf
Please, download CEF4Delphi again from GitHub.

I just uploaded a new CEF4Delphi version and now all TChromium events have a "Sender" parameter, including "OnRenderCompMsg".

Use "Sender" like this to know which browser triggered that event :

Code: Select all

TChromium(Sender).BrowserId
Each browser has a unique "BrowserId" property.

Re: middle mouse button

Posted: Tue Sep 15, 2020 3:28 pm
by kotyara
Thank you very much.