Reputation: 1544
I've recently recompiled TDBGrid component, to implement several custom functions, altho i've noticed that the feature of extra design-time context menu item "Columns editor" is gone now.
I've failed to find any code which creates this menu in original Vcl.DBGrids
unit and had a really bad luck looking for a solution online on how to do this.
This also applies to double-clicking. It used to call Columns Editor, now it just creates OnCellClick event.
Upvotes: 2
Views: 1297
Reputation: 612954
In your design time package for the component, implement a component editor:
type
TMyComponentEditor = class(TComponentEditor)
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
procedure TMyComponentEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0:
Beep;
end;
end;
function TMyComponentEditor.GetVerb(Index: Integer): string;
begin
Result := 'Beep';
end;
function TMyComponentEditor.GetVerbCount: Integer;
begin
Result := 1;
end;
You need to register this component editor also. Call RegisterComponentEditor
in your Register
procedure to do so:
RegisterComponentEditor(TMyComponent, TMyComponentEditor);
Upvotes: 5