I want to avoid mouse right click on the edit boxes of my application which I am doing in BDS 2006. I googled about it and i found a code as follows.
noPopUp := TPopupMenu.create(Edit1); Edit1.PopupMenu := noPopup; This is written on form activate. It works fine for edit1, but there are many edit boxes on the form so i wrote a for loop,
for i := 0 to Self.ControlCount-1 do begin if Self.Controls[i].ClassName = 'TEdit' then begin noPopUp := TPopupMenu.create(Self.Controls[i]); TEdit(Self.Controls[i]).PopupMenu := noPopup; end; end; This works fine for the edit boxes whose parent is Form. But if there are edit boxes on groupboxes or panels then, these panels and groupboxes in turn children of the form.
So my question is how to disable mouse right click on the edit boxes when the parent is not the form?
OnContextPopupand set the 'Handled' parameter 'True'.