Restricting a TKDBGrid PopupMenu to specific columns. lazarus / 31-LCL ---------------------------------------------------------------------- iru · 2016-01-25 19:46 Gentlefolk,  I have followed the instructions at  http://wiki.freepascal.org/TPopupMenu to create a tImage/tPopupMenu which is displayed when i RIGHT click on a TKDBGrid. Works nicely. How do I restrict it to work in one column of the grid only? I can detect the column where the right click occurs with code in TMainForm.KDBGridResultsMouseDown(Sender: TObject.... but how do I stop the tImage/tPopupMenue from being displayed??? Use Image.Visible :=False inhibits the display but it only occurs once and there is no tImage-OnShow event to hang a .Visible := True. A .Free works but I am unsure of any effects of this (memory leaks, etc). Any help appreciated, Ian ---------------------------------------------------------------------- iru · 2016-01-25 21:58 Gentlefolk, Went for a bike ride and sort of put the brain into gear.... How about the following code in TMainForm.KDBGridResultsMouseDown(Sender: TObject....     ImagePop.Visible := False;     If (In required column) then ImagePop.Visible:= True; Ian ---------------------------------------------------------------------- taazz · 2016-01-26 04:10 Quote from: iru on January 25, 2016, 08:46:24 pmGentlefolk,  I have followed the instructions at  http://wiki.freepascal.org/TPopupMenu to create a tImage/tPopupMenu which is displayed when i RIGHT click on a TKDBGrid. Works nicely. How do I restrict it to work in one column of the grid only? I can detect the column where the right click occurs with code in TMainForm.KDBGridResultsMouseDown(Sender: TObject.... but how do I stop the tImage/tPopupMenue from being displayed??? Use Image.Visible :=False inhibits the display but it only occurs once and there is no tImage-OnShow event to hang a .Visible := True. A .Free works but I am unsure of any effects of this (memory leaks, etc). Any help appreciated, Ian How do you show the popup menu in the first place? By setting the popupmenu property of the grid? If yes then don't use the popupMenu property at all and use the popup method the menu you just create something along the lines of Code: [Select]  pmGrid.PopUp(mouse.CursorPos.x,mouse.CursorPos.Y);