Topic: How To Disable/Enable RightClick Popup On TableGrid

How To Disable/Enable RightClick Popup On TableGrid  ?


https://i.ibb.co/hgySrB9/2020-05-19-14-41-30.png

My Visual Database : I Love You
Easy For Beginner Student For Me

2 (edited by derek 2020-05-19 11:16:07)

Re: How To Disable/Enable RightClick Popup On TableGrid

Hi Prahousefamily,
Try inserting this code between the final 'begin' and 'end' of your script to disable one, some or all the right-click options;
begin
   Form1.TableGrid1.dbPopupMenu.Items.find('Show Record').enabled := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Cell').enabled := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Row').enabled := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy All').enabled := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Find').enabled := False;
end.
Or try this to make one, some or all of the options invisible:
begin
   Form1.TableGrid1.dbPopupMenu.Items.find('Show Record').visible := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Cell').visible := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Row').visible := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy All').visible := False;
   Form1.TableGrid1.dbPopupMenu.Items.find('Find').visible := False;
end.
And, of course, you can 'mix' them up to show whatever you want - for example
begin
begin
   Form1.TableGrid1.dbPopupMenu.Items.find('Show Record').caption := 'Is this the record you want to select?';
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Cell').caption := 'Do you want to copy this cell?';
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy Row').visible := false;
   Form1.TableGrid1.dbPopupMenu.Items.find('Copy All').enabled := false;
   Form1.TableGrid1.dbPopupMenu.Items.find('Find').caption := 'What are you looking for?';
end.
Regards,
Derek.
end.

Re: How To Disable/Enable RightClick Popup On TableGrid

Or you can do the following to remove the popup altogether:

Form1.TableGrid1.PopupMenu := nil;