Changeset 349 for trunk/Forms/FormList.pas
- Timestamp:
- Dec 27, 2024, 10:29:54 AM (13 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormList.pas
r346 r349 47 47 Selected: Boolean); 48 48 private 49 FList: IList<TItem>;50 procedure SetList(AValue: IList<TItem>);49 FList: TBaseItemList; 50 procedure SetList(AValue: TBaseItemList); 51 51 procedure UpdateListViewColumns; 52 52 public … … 55 55 procedure UpdateInterface; 56 56 procedure UpdateList; 57 property List: IList<TItem>read FList write SetList;57 property List: TBaseItemList read FList write SetList; 58 58 end; 59 59 … … 84 84 if List.Count <= MinItemCount then Break; 85 85 ListView1.Items[I].Selected := False; 86 List.Remove(TItem(ListView1.Items[I].Data));86 FList.Remove(TItem(ListView1.Items[I].Data)); 87 87 end; 88 88 UpdateList; … … 99 99 if Assigned(ListView1.Selected) then 100 100 with TItem(ListView1.Selected.Data) do begin 101 TempEntry := List.CreateBaseItem;101 TempEntry := FList.CreateItem; 102 102 TempEntry.Assign(TItem(ListView1.Selected.Data)); 103 103 FormItem := TFormItem.Create(Self); … … 121 121 FormItem: TFormItem; 122 122 begin 123 if (MaxItemCount <> -1) and ( List.Count >= MaxItemCount) then Exit;124 125 TempEntry := List.CreateBaseItem;123 if (MaxItemCount <> -1) and (FList.Count >= MaxItemCount) then Exit; 124 125 TempEntry := FList.CreateItem; 126 126 FormItem := TFormItem.Create(Self); 127 127 try 128 TempEntry.Name := List.GetNextAvailableName(SNew + ' ' + LowerCase(List.GetName));128 TempEntry.Name := FList.GetNextAvailableName(SNew + ' ' + LowerCase(List.GetName)); 129 129 FormItem.Item := TempEntry; 130 130 if FormItem.ShowModal = mrOk then begin 131 List.Add(TempEntry);131 FList.Add(TempEntry); 132 132 TempEntry := nil; 133 133 UpdateList; … … 145 145 FormItem: TFormItem; 146 146 begin 147 if (MaxItemCount <> -1) and ( List.Count >= MaxItemCount) then Exit;148 149 TempEntry := List.CreateBaseItem;147 if (MaxItemCount <> -1) and (FList.Count >= MaxItemCount) then Exit; 148 149 TempEntry := FList.CreateItem; 150 150 TempEntry.Assign(TItem(ListView1.Selected.Data)); 151 151 FormItem := TFormItem.Create(Self); … … 154 154 FormItem.Item := TempEntry; 155 155 if FormItem.ShowModal = mrOk then begin 156 List.Add(TempEntry);156 FList.Add(TempEntry); 157 157 TempEntry := nil; 158 158 UpdateList; … … 222 222 begin 223 223 if Item.Index < ListView1.Items.Count then 224 with TItem(List[Item.Index])do begin224 with FList[Item.Index] do begin 225 225 //Item.Caption := GetName; 226 Item.Data := List[Item.Index];227 Fields := List.GetItemFields;226 Item.Data := FList[Item.Index]; 227 Fields := FList.GetItemFields; 228 228 try 229 229 for I := 0 to Fields.Count - 1 do begin … … 256 256 end; 257 257 258 procedure TFormList.SetList(AValue: IList<TItem>);258 procedure TFormList.SetList(AValue: TBaseItemList); 259 259 begin 260 260 if FList = AValue then Exit; … … 269 269 Fields: TItemFields; 270 270 begin 271 if not Assigned(FList) then begin 272 while ListView1.Columns.Count > 0 do 273 ListView1.Columns.Delete(ListView1.Columns.Count - 1); 274 Exit; 275 end; 271 276 Fields := List.GetItemFields; 272 277 ListView1.Columns.BeginUpdate; … … 297 302 procedure TFormList.UpdateList; 298 303 begin 299 if Assigned( List) then ListView1.Items.Count :=List.Count304 if Assigned(FList) then ListView1.Items.Count := FList.Count 300 305 else ListView1.Items.Count := 0; 301 306 ListView1.Refresh;
Note:
See TracChangeset
for help on using the changeset viewer.