Changeset 441 for Generics/TemplateGenerics/Generic/GenericList.inc
- Timestamp:
- Nov 19, 2012, 2:47:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Generic/GenericList.inc
r427 r441 39 39 procedure SetFirst(AValue: TGListItem); 40 40 procedure QuickSort(L, R : TGListIndex; Compare: TSortCompare); 41 procedure DoUpdate; 41 42 protected 42 43 procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual; … … 109 110 begin 110 111 FCount := 0; 112 FUpdateCount := 0; 111 113 end; 112 114 … … 341 343 if (Index < 0) or (Index > FCount) then 342 344 raise EListError.CreateFmt(SListIndexError, [Index]); 343 InsertCount(Index, 1); 344 FItems[Index] := Item; 345 Update; 345 try 346 BeginUpdate; 347 InsertCount(Index, 1); 348 FItems[Index] := Item; 349 finally 350 EndUpdate; 351 end; 346 352 end; 347 353 … … 564 570 procedure TGList.EndUpdate; 565 571 begin 566 Dec(FUpdateCount); 567 Update; 572 if FUpdateCount > 0 then Dec(FUpdateCount); 573 if FUpdateCount = 0 then DoUpdate; 574 end; 575 576 procedure TGList.DoUpdate; 577 begin 578 if Assigned(FOnUpdate) then FOnUpdate(Self); 568 579 end; 569 580 570 581 procedure TGList.Update; 571 582 begin 572 if Assigned(FOnUpdate) and (FUpdateCount = 0) then FOnUpdate(Self);583 if FUpdateCount = 0 then DoUpdate; 573 584 end; 574 585
Note:
See TracChangeset
for help on using the changeset viewer.