Page 1 of 1

Disable back/next mouse buttons

Posted: Wed Aug 11, 2021 1:43 pm
by petko
Some users have mouse with back/next buttons. CEF uses them to go back/next in the navigation history. However, I want to prevent that and to move that logic in my application instead. I can't find a way to do that, since TChromium events are not fired for these buttons, so I was wondering if it is possible to add such setting for CEF?

I have found the following, which might be helpful:
https://magpcss.org/ceforum/viewtopic.php?f=6&t=16543

Re: Disable back/next mouse buttons

Posted: Wed Aug 11, 2021 3:39 pm
by Student
Use the OnRenderCompMsg event

Code: Select all

case aMessage.Msg of
    //button down
    523:
      begin
        case aMessage.wParamHi of
          1: aHandled := true;
          2: aHandled := true;
        end;
      end;
    //button up
    524:
      begin
        case aMessage.wParamHi of
          1:  begin 
               aHandled := true;
                //here you execute your code
               end;
          2:  begin
               aHandled := true;
               //here you execute your code
               end;
        end;
      end;
  end;

Re: Disable back/next mouse buttons

Posted: Thu Aug 12, 2021 11:20 am
by petko
Thanks, that works!