Page 1 of 1
How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Sat Nov 23, 2024 3:41 am
by coater
How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Sender.ClassName always is Tchronium.
Thank you!
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Sat Nov 23, 2024 8:18 am
by coater
I solve that by the Hokey-Pokey Technique. Is there another better solution?
GetClassName(GetParent(GetParent(GetParent(atemphandle))), @arrclass, SizeOf(arrclass)); atempStr := PChar(@arrclass); if (ansipos('Form', atempStr )>0) then PostMessage(Handle, MINIBROWSER_SHOWSEARCHFORM, TempParam, 0);
Chromium_OnPreKeyEvent, arrclass: array[0..254] of Char;
atemphandle: aMsg.hwnd or osEvent.hwnd
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Mon Nov 25, 2024 8:12 am
by salvadordf
Compare the browser.identifier value in that event with TChromiumCore.BrowserId.
They should be different for the DevTools.
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Mon Nov 25, 2024 3:59 pm
by coater
salvadordf wrote: Mon Nov 25, 2024 8:12 am
Compare the browser.identifier value in that event with TChromiumCore.BrowserId.
They should be different for the DevTools.
I'll try it, thank you very much!
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Tue Nov 26, 2024 9:48 am
by coater
TMiniBrowserFrm.Chromium_OnPreKeyEvent (Sender: TObject;
const browser: ICefBrowser; const event: PCefKeyEvent;
osEvent: TCefEventHandle; out isKeyboardShortcut, Result: Boolean);
No TChromiumCore.BrowserId can be found.
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Wed Nov 27, 2024 2:04 pm
by salvadordf
Use the name of the component in your application. For example: Chromium1.BrowserId
Re: How to know the sender is devtools or browser in Chromium_OnPreKeyEvent ?
Posted: Thu Nov 28, 2024 3:53 pm
by coater
salvadordf wrote: Wed Nov 27, 2024 2:04 pm
Use the name of the component in your application. For example:
Chromium1.BrowserId
But I create it for a new window.
