0

When I right-click on a DBGrid it opens a popupmenu, but it also selects (hightlights) the cell I am currently over when right-clicking.

Is there a way to not select(hightlight) the cell I am over when right-clicking and only have the popupmenu open?

Best regards Josef

Joe
  • 2,675
  • 3
  • 21
  • 26

1 Answers1

1

You might intercept WM_RButtonDown for your DBGrid using an interposer class or an own derivied component.
An example could look like:

type
  TDBGrid=Class(VDBGrids.TDBGrid)
    Procedure WMRButtonDown(var Msg:TMessage);Message  WM_RButtonDown;
  End;

  TForm3 = class(TForm)
    ........

implementation

{$R *.dfm}

{ TDBGrid }

procedure TDBGrid.WMRButtonDown(var Msg: TMessage);
begin
   if Tag = 123 then  // abuse the tag or implement an own property to handle only wished grid
      Msg.Result := 0
   else inherited;
end;
bummi
  • 27,123
  • 14
  • 62
  • 101