Given an instance of THYPluginPanel, is there a way to get the associated visual plugin? I’d like to locate the plugin that currently has focus when my Delphi ActionMainMenuBar menus pop (e.g., click the Edit menu and the options are enabled or disabled based on the target).
Here’s sample code that I’m using which overrides TEditCut:
unit TMyEditCut;
interface
uses
Winapi.Windows, System.SysUtils, Vcl.Forms, StdActns, Tx4oleLib_TLB, uHYCLRManagedPluginWrappers;
type
TEditCut = class(StdActns.TEditCut)
public
function HandlesTarget(Target: TObject): Boolean; override;
procedure ExecuteTarget(Target: TObject); override;
procedure UpdateTarget(Target: TObject); override;
end;
implementation
function TEditCut.HandlesTarget(Target: TObject): Boolean;
begin
OutputDebugString(PChar(Format(‘TEditCut.HandlesTarget() - Class: %s’, [Target.ClassName])));
result := (inherited handlesTarget(Target)) or (Target is THYPluginPanel);
end;
procedure TEditCut.ExecuteTarget(Target: TObject);
var
PluginPanel: THYPluginPanel;
begin
OutputDebugString(PChar(Format(‘TEditCut.ExecuteTarget() - Class: %s’, [Target.ClassName])));
if Target.ClassType = THYPluginPanel then begin
// nothing yet
end else
inherited;
end;
procedure TEditCut.UpdateTarget(Target: TObject);
begin
OutputDebugString(PChar(Format(‘TEditCut.UpdateTarget() - Class: %s’, [Target.ClassName])));
if Target.ClassType = THYPluginPanel then
// nothing yet
else
inherited;
end;
end.