|
Using pre-defined events
TComponentInspector cannot retreive the available events automatically, so the event list must be filled in the application using OnGetValuesList event.
type
TMainForm = class(TForm)
ComponentInspector: TComponentInspector;
Button: TButton;
InfoLabel: TLabel;
procedure ShowYes(Sender: TObject);
procedure ShowNo(Sender: TObject);
procedure ComponentInspectorGetValuesList(Sender: TObject;
TheIndex: Integer; const Strings: TStrings);
private
{ Private declarations }
public
{ Public declarations }
end;
...
procedure TMainForm.ShowYes(Sender: TObject);
begin
ShowMessage('YES - YES - YES');
end;
procedure TMainForm.ShowNo(Sender: TObject);
begin
ShowMessage('NO - NO - NO');
end;
procedure TMainForm.ComponentInspectorGetValuesList(Sender: TObject;
TheIndex: Integer; const Strings: TStrings);
begin
with ComponentInspector.Properties[TheIndex] do
if (TypeKind=tkMethod) and (PropType=TypeInfo(TNotifyEvent)) then
with Strings do
begin
Add('ShowYes');
Add('ShowNo');
end;
end;
|