Search code examples
delphipopupmenutms

Assign TPoupMenu to Inplace editor in the TAdvColumnGrid


I am working on TAdvColumnGrid where I am facing one issue with the PopupMenu. I have assign a Popup Menu to the Grid. When the cell in the grid is selected/focused then on right click of Mouse button I can show the PopupMenu.

but if the column cell is in edit mode and I clicked right mouse button then the default windows Popup appear.

I want same popup to be shown as it is showing on cell selection.

Please find the below images of both the popup. Popup 1 and default Popup

please let me know if any more information is needed.

Thanks and regards, Ankit Balbudhe


Solution

  • You havent't mentioned version that you use. But for example for TAdvColumnGrid version 3.1.3.9 you could override the CreateEditor method:

    type
      TAdvColumnGrid = class(AdvCGrid.TAdvColumnGrid)
      protected
        function CreateEditor: TInplaceEdit; override;
      end;
    
    implementation
    
    { TAdvColumnGrid }
    
    function TAdvColumnGrid.CreateEditor: TInplaceEdit;
    begin
      Result := inherited;
      if Result is TAdvInplaceEdit then
        TAdvInplaceEdit(Result).PopupMenu := PopupMenu; { ← assign to editor popup menu }
    end;