Disable back/next mouse buttons

Post Reply
petko
Posts: 47
Joined: Sun Jul 02, 2017 9:58 am

Disable back/next mouse buttons

Post 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
Student
Posts: 55
Joined: Tue Aug 07, 2018 9:20 am

Re: Disable back/next mouse buttons

Post 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;
petko
Posts: 47
Joined: Sun Jul 02, 2017 9:58 am

Re: Disable back/next mouse buttons

Post by petko »

Thanks, that works!
Post Reply