Changeset 56 for trunk/Forms
- Timestamp:
- Dec 8, 2021, 4:44:21 PM (3 years ago)
- Location:
- trunk/Forms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormProperty.lfm
r39 r56 1 1 object FormProperty: TFormProperty 2 2 Left = 760 3 Height = 5254 Top = 4695 Width = 8023 Height = 418 4 Top = 576 5 Width = 726 6 6 Caption = 'Field' 7 ClientHeight = 5258 ClientWidth = 8027 ClientHeight = 418 8 ClientWidth = 726 9 9 DesignTimePPI = 144 10 10 OnClose = FormClose … … 13 13 LCLVersion = '2.0.12.0' 14 14 object ButtonOk: TButton 15 Left = 53615 Left = 460 16 16 Height = 37 17 Top = 47217 Top = 365 18 18 Width = 119 19 19 Anchors = [akRight, akBottom] … … 25 25 end 26 26 object ButtonCancel: TButton 27 Left = 67227 Left = 596 28 28 Height = 37 29 Top = 47229 Top = 365 30 30 Width = 115 31 31 Anchors = [akRight, akBottom] … … 38 38 Left = 24 39 39 Height = 24 40 Top = 2040 Top = 80 41 41 Width = 56 42 42 Caption = 'Name:' … … 44 44 end 45 45 object EditName: TEdit 46 Left = 16 646 Left = 168 47 47 Height = 42 48 Top = 20 49 Width = 322 48 Top = 72 49 Width = 532 50 Anchors = [akTop, akLeft, akRight] 51 OnChange = EditNameChange 50 52 TabOrder = 2 51 53 end … … 53 55 Left = 24 54 56 Height = 24 55 Top = 7257 Top = 128 56 58 Width = 88 57 59 Caption = 'Attributes:' … … 59 61 end 60 62 object EditAttributes: TEdit 61 Left = 16 663 Left = 168 62 64 Height = 42 63 Top = 72 64 Width = 322 65 Top = 124 66 Width = 532 67 Anchors = [akTop, akLeft, akRight] 68 OnChange = EditAttributesChange 65 69 TabOrder = 3 66 70 end … … 68 72 Left = 24 69 73 Height = 24 70 Top = 1 2874 Top = 180 71 75 Width = 60 72 76 Caption = 'Values:' … … 74 78 end 75 79 object EditValues: TEdit 76 Left = 16 680 Left = 168 77 81 Height = 42 78 Top = 120 79 Width = 322 82 Top = 172 83 Width = 532 84 Anchors = [akTop, akLeft, akRight] 80 85 TabOrder = 4 81 86 end 87 object Label4: TLabel 88 Left = 24 89 Height = 24 90 Top = 32 91 Width = 45 92 Caption = 'Field:' 93 ParentColor = False 94 end 95 object ComboBoxField: TComboBox 96 Left = 168 97 Height = 42 98 Top = 24 99 Width = 532 100 Anchors = [akTop, akLeft, akRight] 101 ItemHeight = 0 102 OnChange = ComboBoxFieldChange 103 Style = csDropDownList 104 TabOrder = 5 105 end 82 106 end -
trunk/Forms/UFormProperty.lrj
r39 r56 5 5 {"hash":5538698,"name":"tformproperty.label1.caption","sourcebytes":[78,97,109,101,58],"value":"Name:"}, 6 6 {"hash":265557994,"name":"tformproperty.label2.caption","sourcebytes":[65,116,116,114,105,98,117,116,101,115,58],"value":"Attributes:"}, 7 {"hash":209959994,"name":"tformproperty.label3.caption","sourcebytes":[86,97,108,117,101,115,58],"value":"Values:"} 7 {"hash":209959994,"name":"tformproperty.label3.caption","sourcebytes":[86,97,108,117,101,115,58],"value":"Values:"}, 8 {"hash":80724602,"name":"tformproperty.label4.caption","sourcebytes":[70,105,101,108,100,58],"value":"Field:"} 8 9 ]} -
trunk/Forms/UFormProperty.pas
r42 r56 15 15 ButtonCancel: TButton; 16 16 ButtonOk: TButton; 17 ComboBoxField: TComboBox; 17 18 EditName: TEdit; 18 19 EditAttributes: TEdit; … … 21 22 Label2: TLabel; 22 23 Label3: TLabel; 24 Label4: TLabel; 23 25 procedure ButtonOkClick(Sender: TObject); 26 procedure ComboBoxFieldChange(Sender: TObject); 27 procedure EditAttributesChange(Sender: TObject); 28 procedure EditNameChange(Sender: TObject); 24 29 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 25 30 procedure FormCreate(Sender: TObject); … … 27 32 private 28 33 FContactProperty: TContactProperty; 34 procedure UpdateField; 29 35 procedure SetContactProperty(AValue: TContactProperty); 30 36 procedure LoadData; … … 51 57 end; 52 58 59 procedure TFormProperty.ComboBoxFieldChange(Sender: TObject); 60 var 61 Field: TContactField; 62 Attributes: TStringList; 63 I: Integer; 64 begin 65 if ComboBoxField.ItemIndex <> -1 then begin 66 Field := TContactsFile(Core.DataFile).Fields[ComboBoxField.ItemIndex]; 67 if Assigned(Field) then begin 68 EditName.Text := Field.SysName; 69 Attributes := TStringList.Create; 70 try 71 Attributes.NameValueSeparator := '='; 72 Attributes.Delimiter := ';'; 73 Attributes.StrictDelimiter := True; 74 for I := 0 to Length(Field.Groups) - 1 do 75 Attributes.Add(Field.Groups[I]); 76 EditAttributes.Text := Attributes.DelimitedText; 77 finally 78 Attributes.Free; 79 end; 80 end; 81 end; 82 end; 83 84 procedure TFormProperty.EditAttributesChange(Sender: TObject); 85 begin 86 UpdateField; 87 end; 88 89 procedure TFormProperty.EditNameChange(Sender: TObject); 90 begin 91 UpdateField; 92 end; 93 53 94 procedure TFormProperty.FormClose(Sender: TObject; var CloseAction: TCloseAction); 54 95 begin … … 61 102 Core.ThemeManager1.UseTheme(Self); 62 103 FContactProperty := nil; 104 TContactsFile(Core.DataFile).Fields.LoadToStrings(ComboBoxField.Items); 63 105 end; 64 106 … … 66 108 begin 67 109 Core.PersistentForm1.Load(Self); 110 end; 111 112 procedure TFormProperty.UpdateField; 113 var 114 Field: TContactField; 115 Groups: TStringList; 116 GroupsArray: TStringArray; 117 I: Integer; 118 begin 119 Groups := TStringList.Create; 120 try 121 Groups.NameValueSeparator := '='; 122 Groups.Delimiter := ';'; 123 Groups.StrictDelimiter := True; 124 Groups.DelimitedText := EditAttributes.Text; 125 SetLength(GroupsArray, Groups.Count); 126 for I := 0 to Groups.Count - 1 do 127 GroupsArray[I] := Groups[I]; 128 finally 129 Groups.Free; 130 end; 131 Field := TContactsFile(Core.DataFile).Fields.GetBySysNameGroups(EditName.Text, 132 GroupsArray); 133 if Assigned(Field) then 134 ComboBoxField.ItemIndex := TContactsFile(Core.DataFile).Fields.IndexOf(Field); 68 135 end; 69 136
Note:
See TracChangeset
for help on using the changeset viewer.