Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6909947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:45:12+00:00 2026-05-27T08:45:12+00:00

I have a TChromium broser from Delphi Chromium Embedded (http://code.google.com/p/delphichromiumembedded). I would like to

  • 0

I have a TChromium broser from Delphi Chromium Embedded (http://code.google.com/p/delphichromiumembedded). I would like to attach a context menu to it. How I can achieve that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:45:12+00:00Added an answer on May 27, 2026 at 8:45 am

    You need to handle the OnBeforeMenu event. In that event handler is enough to set the output parameter Result to True what will suppress the default context menus to popup. After that you can display your own menu on the positions obtained from the menuInfo structure.

    Here’s the code sample with a custom popup menu:

    uses
      ceflib, cefvcl;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Chromium1.Load('www.example.com');
    end;
    
    procedure TForm1.Chromium1BeforeMenu(Sender: TObject;
      const browser: ICefBrowser; const menuInfo: PCefHandlerMenuInfo;
      out Result: Boolean);
    begin
      Result := True;
      PopupMenu1.Popup(menuInfo.x, menuInfo.y);
    end;
    
    procedure TForm1.PopupMenuItemClick(Sender: TObject);
    begin
      ShowMessage('You''ve clicked on a custom popup item :)');
    end;
    

    Update:

    For dynamically created instance you have to assign the event handler manually. Try the following code.

    uses
      ceflib, cefvcl;
    
    type
      TForm1 = class(TForm)
        Panel1: TPanel;
        Button1: TButton;
        PopupMenu1: TPopupMenu;
        procedure Button1Click(Sender: TObject);
      private
        procedure ChromiumOnBeforeMenu(Sender: TObject;
          const browser: ICefBrowser; const menuInfo: PCefHandlerMenuInfo;
          out Result: Boolean);
      public
        { Public declarations }
      end;
    
    implementation
    
    procedure Form1.ChromiumOnBeforeMenu(Sender: TObject; const browser: ICefBrowser;
      const menuInfo: PCefHandlerMenuInfo; out Result: Boolean);
    begin
      Result := True;
      PopupMenu1.Popup(menuInfo.x, menuInfo.y);
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      Chromium: TChromium;
    begin
      // owner is responsible for destroying the component
      // in this case you are telling to Panel1 to destroy
      // the Chromium instance before he destroys itself,
      // it doesn't affect the event handling
      Chromium := TChromium.Create(Panel1);
    
      Chromium.Parent := Panel1;
      Chromium.Left := 10;
      Chromium.Top := 10;
      Chromium.Width := Panel1.Width - 20;
      Chromium.Height := Panel1.Height - 20;
    
      // this line is important, you are assigning the event
      // handler for OnBeforeMenu event, so in fact you tell
      // to the Chromium; hey if the OnBeforeMenu fires, run
      // the code I'm pointing at, in this case will execute
      // the ChromiumOnBeforeMenu procedure
      Chromium.OnBeforeMenu := ChromiumOnBeforeMenu;
    
      Chromium.Load('www.example.com');
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While stumbling through the chromium code documentation, I came across this post: http://code.google.com/p/chromium/wiki/UsingGit#Windows If
I have successfully embedded Chromium into my Delphi 6 projects with the help of
I have some code that retrieves a scripted svg image from a server via
I have the following PHP code which simply grabs a URL behind HTTP-Basic authentication
How would you setup an code repository where you have a proprietary version and
I'm looking for a shortcut in vim that would launch chrome/chromium and have it
I would like to capture sound from a browser and send it to a
I have a Java applet that downloads data from where it's hosted, using HTTP.
Have just started using Google Chrome , and noticed in parts of our site,
Have you guys had any experiences (positive or negative) by placing your source code/solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.