Changeset 121
- Timestamp:
- Nov 29, 2017, 1:34:17 PM (7 years ago)
- Location:
- branches/generator/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormRules.lfm
r119 r121 86 86 TabOrder = 1 87 87 ViewStyle = vsReport 88 OnCompare = ListView1Compare 88 89 OnData = ListView1Data 89 90 OnDblClick = ListView1DblClick … … 237 238 end 238 239 end 240 object ListViewSort1: TListViewSort 241 ListView = ListView1 242 OnCompareItem = ListViewSort1CompareItem 243 OnFilter = ListViewSort1Filter 244 Column = 0 245 Order = soUp 246 left = 574 247 top = 212 248 end 239 249 end -
branches/generator/Forms/UFormRules.pas
r119 r121 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, 9 ComCtrls, ActnList, Menus, URules ;9 ComCtrls, ActnList, Menus, URules, UListViewSort; 10 10 11 11 type … … 20 20 CoolBar1: TCoolBar; 21 21 ListView1: TListView; 22 ListViewSort1: TListViewSort; 22 23 MenuItem1: TMenuItem; 23 24 MenuItem2: TMenuItem; … … 34 35 procedure FormCreate(Sender: TObject); 35 36 procedure FormShow(Sender: TObject); 37 procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem; 38 Data: Integer; var Compare: Integer); 36 39 procedure ListView1Data(Sender: TObject; Item: TListItem); 37 40 procedure ListView1DblClick(Sender: TObject); … … 39 42 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; 40 43 Selected: Boolean); 44 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 45 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 41 46 private 42 47 { private declarations } … … 68 73 ReloadList; 69 74 UpdateInterface; 75 end; 76 77 procedure TFormRules.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; 78 Data: Integer; var Compare: Integer); 79 begin 80 70 81 end; 71 82 … … 125 136 procedure TFormRules.ListView1Data(Sender: TObject; Item: TListItem); 126 137 begin 127 if (Item.Index >= 0) and (Item.Index < Rules.Count) then begin 128 Item.Caption := Rules[Item.Index].Name; 129 Item.Data := Rules[Item.Index]; 130 Item.SubItems.Add(BooleanText[Rules[Item.Index].CreateSourceNode]); 131 Item.SubItems.Add(Rules[Item.Index].Items.GetString); 138 if (Item.Index >= 0) and (Item.Index < ListViewSort1.List.Count) then 139 with TRule(ListViewSort1.List[Item.Index]) do begin 140 Item.Caption := Name; 141 Item.Data := ListViewSort1.List[Item.Index]; 142 Item.SubItems.Add(BooleanText[CreateSourceNode]); 143 Item.SubItems.Add(Items.GetString); 132 144 end; 133 145 end; … … 149 161 end; 150 162 163 function TFormRules.ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 164 begin 165 Result := 0; 166 if Assigned(Item1) and Assigned(Item2) and (ListViewSort1.Order <> soNone) then begin 167 with ListViewSort1 do 168 case Column of 169 0: Result := CompareString(TRule(Item1).Name, TRule(Item2).Name); 170 1: Result := CompareString(BooleanText[TRule(Item1).CreateSourceNode], BooleanText[TRule(Item2).CreateSourceNode]); 171 2: Result := CompareString(TRule(Item1).GetString, TRule(Item2).GetString); 172 end; 173 if ListViewSort1.Order = soDown then Result := -Result; 174 end else Result := 0; 175 end; 176 177 procedure TFormRules.ListViewSort1Filter(ListViewSort: TListViewSort); 178 var 179 I: Integer; 180 begin 181 ListViewSort1.List.Count := Rules.Count; 182 for I := 0 to Rules.Count - 1 do 183 ListViewSort1.List[I] := Rules[I]; 184 //FilterList(ListViewSort1.List); 185 end; 186 151 187 procedure TFormRules.UpdateInterface; 152 188 begin … … 157 193 procedure TFormRules.ReloadList; 158 194 begin 159 if Assigned(Rules) then ListView 1.Items.Count := Rules.Count160 else ListView 1.Items.Count := 0;195 if Assigned(Rules) then ListViewSort1.Refresh 196 else ListViewSort1.List.Count := 0; 161 197 ListView1.Refresh; 162 198 end;
Note:
See TracChangeset
for help on using the changeset viewer.