Changeset 111 for branches/generator/Forms/UFormRule.pas
- Timestamp:
- Aug 9, 2017, 12:09:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormRule.pas
r110 r111 20 20 ButtonOk: TButton; 21 21 ButtonCancel: TButton; 22 ComboBox1: TComboBox; 22 23 EditName: TEdit; 23 24 Label1: TLabel; 25 Label2: TLabel; 24 26 ListView: TListView; 25 27 MenuItem1: TMenuItem; … … 39 41 { private declarations } 40 42 public 41 Rule Items: TRuleItems;43 Rule: TRule; 42 44 procedure UpdateInterface; 43 45 procedure ReloadList; … … 68 70 procedure TFormRule.ListViewData(Sender: TObject; Item: TListItem); 69 71 begin 70 if (Item.Index >= 0) and (Item.Index < Rule Items.Count) then begin71 Item.Caption := Rule Items[Item.Index].Name;72 Item.Data := Rule Items[Item.Index];72 if (Item.Index >= 0) and (Item.Index < Rule.Items.Count) then begin 73 Item.Caption := Rule.Items[Item.Index].GetBNF; 74 Item.Data := Rule.Items[Item.Index]; 73 75 end; 74 76 end; … … 95 97 begin 96 98 NewRuleItem := TRuleItem.Create; 99 NewRuleItem.Grammer := Rule.Grammer; 97 100 FormRuleItem.LoadData(NewRuleItem); 98 101 if FormRuleItem.ShowModal = mrOk then begin 99 102 FormRuleItem.SaveData(NewRuleItem); 100 RuleItems.Add(NewRuleItem); 103 NewRuleItem.ParentRule := Rule; 104 Rule.Items.Add(NewRuleItem); 101 105 ReloadList; 102 106 end else FreeAndNil(NewRuleItem); … … 121 125 for Item in ListView.Items do 122 126 if Item.Selected then 123 Rule Items.Remove(TRuleItem(Item.Data));127 Rule.Items.Remove(TRuleItem(Item.Data)); 124 128 ReloadList; 125 129 end; … … 133 137 procedure TFormRule.ReloadList; 134 138 begin 135 ListView.Items.Count := Rule Items.Count;139 ListView.Items.Count := Rule.Items.Count; 136 140 ListView.Refresh; 137 141 end; … … 139 143 procedure TFormRule.LoadData(Rule: TRule); 140 144 begin 145 Self.Rule := Rule; 146 ComboBox1.ItemIndex := Integer(Rule.RuleType); 141 147 EditName.Text := Rule.Name; 142 Rule Items := Rule.Items;148 Rule.Items := Rule.Items; 143 149 end; 144 150 145 151 procedure TFormRule.SaveData(Rule: TRule); 146 152 begin 153 Rule.RuleType := TRuleType(ComboBox1.ItemIndex); 147 154 Rule.Name := EditName.Text; 148 155 end;
Note:
See TracChangeset
for help on using the changeset viewer.