Question

Here is ceflib.pas code CEFLIB.PAS


So in TCefRenderProcessHandlerOwn class, declared OnBeforeNavigation function.
As we can see, it returns False everytime and its bad, because if Link was opened by MouseWheelClick it will not open this link in New Tab, i want to fix it.
The question is: How to rewrite this function?
TNX

Was it helpful?

Solution

I've never used this library, but it looks to me like you need to do the following:

  1. Define a class that derives from TCefRenderProcessHandlerOwn.
  2. Override the method you are interested in customising. In this case OnBeforeNavigation.
  3. At initialization time, instantiate your class and assign that to the CefRenderProcessHandler global variable.

 

type 
  TMyRenderProcessHandler = class(TCefRenderProcessHandlerOwn)
  protected
    function OnBeforeNavigation(const browser: ICefBrowser; 
      const frame: ICefFrame; const request: ICefRequest; 
      navigationType: TCefNavigationType; isRedirect: Boolean): Boolean;
      override;
  end;

function TMyRenderProcessHandler.OnBeforeNavigation(const browser: ICefBrowser; 
  const frame: ICefFrame; const request: ICefRequest; 
  navigationType: TCefNavigationType; isRedirect: Boolean): Boolean;
begin
  .... your code goes here
end;      

initialization
  CefRenderProcessHandler := TMyRenderProcessHandler.Create;

The project comes with demo programs that illustrate this technique. I suggest that you study those demos to learn more about this very powerful component.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top