Jump to content

How to discard browser popup menu?


Freeman35

Recommended Posts

Hello,

I need to discard browser popup menu. But not all in application. I mean I don't wanna use "MainModule.BrowserOptions.boDisableMouseRightClick = True"

My code is:

procedure TFRM_.EDT_MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Button=mbRight then POP_1.Popup( X, Y, Sender);

Result is on :) screenshot. Browser popup on my popup. both opened.

Ekran Resmi 2019-01-15 13.52.57.png

Link to comment
Share on other sites

6 minutes ago, Freeman35 said:

I need to discard browser popup menu. But not all in application. I mean I don't wanna use "MainModule.BrowserOptions.boDisableMouseRightClick = True"

Hello,

Can you try this old solution?

http://forums.unigui.com/index.php?/topic/3137-is-it-possible-to-change-unimainmodulebrowseroptions-at-runtime/&do=findComment&comment=21489

Link to comment
Share on other sites

Thank you it been helpful for me.

procedure TFRM_.EDT_MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Button=mbRight then begin
    MainModule.UniMainModule.BrowserOptions:= [boDisableMouseRightClick];
    UniSession.AddJS('document.oncontextmenu = document.body.oncontextmenu = function () { return false; }');
  end;
end;

procedure TFRM_.EDT_MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Button=mbRight then begin
   POP_1.Popup( X, Y, Sender);
   MainModule.UniMainModule.BrowserOptions:= [];
   UniSession.AddJS('document.oncontextmenu = document.body.oncontextmenu = function () { return true; }');
  end;
end;

Why I used MouseDown, 'cos need delay for run, before popup.

regards.

Link to comment
Share on other sites

Sorry, You should not use this code in this way. This code should work independently, say when you want to prevent or show a standard pop-up window ...

1 hour ago, Sherzod said:

But not all in application

It seems I didn't quite understand what you wanted.

Link to comment
Share on other sites

I wanna use this code in dbgrid filter use. I mean, Example: I have two columns and two TUniEdit for filter. But this string can be in sql where clause "Equal, NotEqual, Starts ,Ends, Contains" for this selection I have popmenu. I need this popup menu just in TUniEdit for filter usage. and not everytime. If end user want, then it will popup via right click. not always.

I hope could tranlate my ideas :)

thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...