@@ -15,6 +15,10 @@ interface
1515 TC4DWizardIDEPopupMenuDesignerComponentSel = class
1616 private
1717 class procedure CopyNamesClick (Sender: TObject);
18+ class procedure AddItem (const AItem: IMenuItem; const ACaption: WideString;
19+ const AName: string = ' ' ; AOnClick: TNotifyEvent = nil );
20+ class procedure CopyDataFieldsClick (Sender: TObject);
21+ class procedure CopyDataFields ;
1822 public
1923 class procedure AddSubItems (const AItem: IMenuItem);
2024 class procedure CopyNames ;
@@ -27,7 +31,14 @@ implementation
2731
2832class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.AddSubItems (const AItem: IMenuItem);
2933begin
30- AItem.AddItem(' Copy names of selected components' , TextToShortCut(' ' ), False, True, Self.CopyNamesClick, 0 , ' C4DWizardIDEPopupMenuDesignerComponentSel1' );
34+ Self.AddItem(AItem, ' Copy names of selected components' , ' C4DWizardNamesComponentSel1' , Self.CopyNamesClick);
35+ Self.AddItem(AItem, ' Copy DataField of selected components' , ' C4DWizardDataFieldComponentSel1' , Self.CopyDataFieldsClick);
36+ end ;
37+
38+ class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.AddItem (const AItem: IMenuItem; const ACaption: WideString;
39+ const AName: string = ' ' ; AOnClick: TNotifyEvent = nil );
40+ begin
41+ AItem.AddItem(ACaption, TextToShortCut(' ' ), False, True, AOnClick, 0 , AName);
3142end ;
3243
3344class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.CopyNamesClick (Sender: TObject);
@@ -41,27 +52,67 @@ class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.CopyNames;
4152 LIOTAFormEditor: IOTAFormEditor;
4253 LIOTAComponent: IOTAComponent;
4354 LStrList: TStringList;
44- LNomeComponente: String;
55+ LNameComponent: String;
56+ LSelCount: Integer;
57+ begin
58+ LIOTAModule := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
59+ if not Assigned(LIOTAModule) then
60+ Exit;
61+
62+ LIOTAFormEditor := TC4DWizardUtilsOTA.GetIOTAFormEditor(LIOTAModule);
63+ if not Assigned(LIOTAFormEditor) then
64+ Exit;
65+
66+ LStrList := TStringList.Create;
67+ try
68+ for LSelCount := 0 to Pred(LIOTAFormEditor.GetSelCount) do
69+ begin
70+ LIOTAComponent := LIOTAFormEditor.GetSelComponent(LSelCount);
71+ LIOTAComponent.GetPropValueByName(' Name' , LNameComponent);
72+ LStrList.Add(LNameComponent);
73+ end ;
74+
75+ if not Trim(LStrList.Text).IsEmpty then
76+ Clipboard.AsText := LStrList.Text;
77+ finally
78+ LStrList.Free;
79+ end ;
80+ end ;
81+
82+ class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.CopyDataFieldsClick (Sender: TObject);
83+ begin
84+ Self.CopyDataFields;
85+ end ;
86+
87+ class procedure TC4DWizardIDEPopupMenuDesignerComponentSel.CopyDataFields ;
88+ var
89+ LIOTAModule: IOTAModule;
90+ LIOTAFormEditor: IOTAFormEditor;
91+ LIOTAComponent: IOTAComponent;
92+ LStrList: TStringList;
93+ LNameComponent: String;
4594 LSelCount: Integer;
4695begin
4796 LIOTAModule := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
48- if ( not Assigned(LIOTAModule)) then
97+ if not Assigned(LIOTAModule) then
4998 Exit;
5099
51100 LIOTAFormEditor := TC4DWizardUtilsOTA.GetIOTAFormEditor(LIOTAModule);
52- if ( not Assigned(LIOTAFormEditor)) then
101+ if not Assigned(LIOTAFormEditor) then
53102 Exit;
54103
55104 LStrList := TStringList.Create;
56105 try
57106 for LSelCount := 0 to Pred(LIOTAFormEditor.GetSelCount) do
58107 begin
59108 LIOTAComponent := LIOTAFormEditor.GetSelComponent(LSelCount);
60- LIOTAComponent.GetPropValueByName(' Name' , LNomeComponente);
61- LStrList.Add(LNomeComponente)
109+ LIOTAComponent.GetPropValueByName(' DataField' , LNameComponent);
110+ if not LNameComponent.Trim.IsEmpty then
111+ LStrList.Add(LNameComponent);
62112 end ;
63113
64- Clipboard.AsText := LStrList.Text;
114+ if not Trim(LStrList.Text).IsEmpty then
115+ Clipboard.AsText := LStrList.Text;
65116 finally
66117 LStrList.Free;
67118 end ;
0 commit comments