Defines a generics-based TStrings implementation that can privately store an extra item (determined by <T>) in the Data field for each Item in the TStrings list.
The RSGenerics.Collections.TStringList<T>.OwnsObjects property controls whether the TStringList<T> automatically frees its associated Objects.
Many controls in Delphi (such as FMX TListBox) have a TStrings interface and an associated items interface (e.g., ListItems). Maintaining two lists are inefficient. RiverSoftAVG gets around this limitation by using this class, the generics version of a TStrings.
Important Note |
---|
It is highly recommended that you use the TObjectStringList class if the associated item <T> is to be a TObject or descendant. The TObjectStringList class will maintain and even optionally free the associated item for you. |
Note |
---|
This class is intended to replace TGStringList and TIStringList classes from older RiverSoftAVG code in newer versions (XE4+) of Delphi. |
Warning |
---|
This class cannot be used in XE4 or earlier because of generics compiler errors. |
Namespace: RSGenerics.Collections
TStrings |
Delphi |
type |
Type Parameters
T
|
|
||||||||||||||||||||||||||||||||||||||||||||
Occurs immediately after the list of strings changes. Write an OnChange event handler to respond to changes in the list of strings. For example, if the string list is associated with a control, the OnChange event handler could tell the control to repaint itself whenever the content of the list changes. Whenever strings in the list are added, deleted, moved, or modified, the following events take place: • An OnChanging event occurs before the change. • The strings are added, deleted, moved, or modified. • An OnChange event occurs. |
Note |
---|
OnChange occurs for every change made to the list, regardless of whether the application calls BeginUpdate and EndUpdate around a series of changes. |
Occurs immediately before the list of strings changes.
Write an OnChanging event handler to prepare for changes in the list of strings. For example, if the string list is associated with a control, the OnChanging event handler could tell the control to disable repaints until the RSGenerics.Collections.TStringList<T>.OnChange event is triggered, notifying the control that the list has finished changing.
Whenever strings in the list are added, deleted, moved, or modified, the following events take place:
• An OnChanging event occurs before the change.
• The strings are added, deleted, moved, or modified.
• An OnChange event occurs.
Note |
---|
OnChanging occurs for every change made to the list, regardless of whether the application calls BeginUpdate and EndUpdate around a series of changes. |
Specifies whether to free the associated Object when a string is deleted from the string list.
Specifies whether the strings in the list should be automatically sorted.
Set Sorted to true to cause the strings in the list to be automatically sorted in ascending order. Set Sorted to false to allow strings to remain where they are inserted. When Sorted is false, the strings in the list can be put in ascending order at any time by calling the Sort method.
When Sorted is true, do not use Insert to add strings to the list. Instead, use Add, which will insert the new strings in the appropriate position. When Sorted is false, use Insert to add strings to an arbitrary position in the list, or Add to add strings to the end of the list.
Note |
---|
The CaseSensitive property controls whether the strings in the list are sorted based on a case-sensitive or case-insensitive comparison. The sort order takes into account the locale of the system on which the application is running. |
|