Mega Code Archive

 
Categories / Delphi / System
 

EasySymantecMenuEditor

Title: EasySymantecMenuEditor Question: This article contains the unit EasySymantecMenuEditor. This is used together with the EasySymantecMenu to get right click menus inside Delphi. NOTE! You need the other posts to be able to compile this components. You must disable the Compiled Resources (*.dcr) to compile this components. I'll send the dcr's to the admins and tell them to attach them. Answer: Unit EasySymantecMenuEditor; Interface Uses {$IFDEF Ver140} DesignEditors, DesignIntf, {$ELSE} dsgnintf, {$ENDIF} Classes, Controls, Dialogs, EasySymantecMenu, EasyToolBarButtons ; Type TEasySymantecMenuNavigationBarEditor = class(TComponentEditor) Public Function GetVerbCount : Integer; override; Function GetVerb(Index : Integer) : String; override; Procedure ExecuteVerb(Index : Integer); override; End; TEasySymantecMenuEditor = class(TComponentEditor) Public Function GetVerbCount : Integer; override; Function GetVerb(Index : Integer) : String; override; Procedure ExecuteVerb(Index : Integer); override; End; Procedure Register; Implementation Procedure Register; Begin RegisterComponentEditor(TEasySymantecMenu, TEasySymantecMenuEditor); RegisterComponentEditor(TEasySymantecMenuNavigationBar, TEasySymantecMenuNavigationBarEditor); End; Function TEasySymantecMenuNavigationBarEditor.GetVerbCount : Integer; Begin Result := 1; End; Function TEasySymantecMenuNavigationBarEditor.GetVerb(Index : Integer) : String; Begin Case Index of 0 : Result := 'Add Navigation Option'; End; End; Procedure TEasySymantecMenuNavigationBarEditor.ExecuteVerb(Index : Integer); Var C : TComponent; Begin Case Index of 0 : Begin C := Designer.CreateComponent(TEasySymantecMenuNavigationOption, Component, 0, 0, 24, 24); (C as TEasySymantecMenuNavigationOption).Align := alBottom; (C as TEasySymantecMenuNavigationOption).Align := alTop; Designer.Modified; End; End; End; (******************************************************************************) (******************************************************************************) (******************************************************************************) Function TEasySymantecMenuEditor.GetVerbCount : Integer; Begin Result := 3; End; Function TEasySymantecMenuEditor.GetVerb(Index : Integer) : String; Begin Case Index of 0 : Result := 'Add Button'; 1 : Result := 'Add Navigation Bar'; 2 : Result := 'About'; End; End; Procedure TEasySymantecMenuEditor.ExecuteVerb(Index : Integer); Begin Case Index of 0 : Begin Designer.CreateComponent(TEasyToolBarButton, Component, 0, 0, 24, 24); (Component as TEasySymantecMenu).RepositionButtons; Designer.Modified; End; 1 : Begin Designer.CreateComponent(TEasySymantecMenuNavigationBar, Component, 0, 0, 24, 24); Designer.Modified; End; 2 : MessageDLG('TEasySymantectMenu by EasyWare.org', mtInformation, [mbOk], 0); End; End; (******************************************************************************) (******************************************************************************) (******************************************************************************) End.