donlego Posted July 31, 2019 Share Posted July 31, 2019 with UniMainModule.BrowserOptions:=[boDisableMouseRightClick ] it disable all right click on browser but how to disable right click spesific to dbgrid/stringgrid only Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2019 Share Posted July 31, 2019 2 hours ago, donlego said: with UniMainModule.BrowserOptions:=[boDisableMouseRightClick ] it disable all right click on browser but how to disable right click spesific to dbgrid/stringgrid only Hello, You can try something like this: procedure TMainForm.UniFormCreate(Sender: TObject); var IDs: string; begin IDs := UniDBGrid1.JSId + ',' + UniStringGrid1.JSId; UniSession.AddJS('document.oncontextmenu = document.body.oncontextmenu = '+ ' function (e) { var s=true; e.path.forEach(function(el){'+ ' if(el.id!="" && "'+ IDs +'".includes(el.id)){s=false}'+ ' });'+ 'return s}'); end; Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted September 19, 2019 Share Posted September 19, 2019 On 7/31/2019 at 2:57 AM, Sherzod said: Hello, You can try something like this: procedure TMainForm.UniFormCreate(Sender: TObject); var IDs: string; begin IDs := UniDBGrid1.JSId + ',' + UniStringGrid1.JSId; UniSession.AddJS('document.oncontextmenu = document.body.oncontextmenu = '+ ' function (e) { var s=true; e.path.forEach(function(el){'+ ' if(el.id!="" && "'+ IDs +'".includes(el.id)){s=false}'+ ' });'+ 'return s}'); end; I used this code to block the right mouse button on the stringgrid and I used this other code below to open a poupupmenu, which abge the 2. procedure TForm.StringGridFaultMouseDown (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Button = mbRight then UniPopupMenu2.Popup (X, Y, StringGridFaults); end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.