<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.soldat.pl/index.php?action=history&amp;feed=atom&amp;title=TStringList.OnChange</id>
		<title>TStringList.OnChange - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.soldat.pl/index.php?action=history&amp;feed=atom&amp;title=TStringList.OnChange"/>
		<link rel="alternate" type="text/html" href="https://wiki.soldat.pl/index.php?title=TStringList.OnChange&amp;action=history"/>
		<updated>2026-05-03T09:56:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.soldat.pl/index.php?title=TStringList.OnChange&amp;diff=1187&amp;oldid=prev</id>
		<title>Mighty: new page</title>
		<link rel="alternate" type="text/html" href="https://wiki.soldat.pl/index.php?title=TStringList.OnChange&amp;diff=1187&amp;oldid=prev"/>
				<updated>2013-08-24T18:13:58Z</updated>
		
		<summary type="html">&lt;p&gt;new page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; '''property OnChange: [[TNotifyEvent]]'''&lt;br /&gt;
  Access mode: RW&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
{{link|TStringList|OnChange}} can be assigned to respond to changes that have occurred in the list. The handler is called whenever strings are added, moved, modified or deleted from the list.&lt;br /&gt;
&lt;br /&gt;
The {{link|TStringList|OnChange}} event is triggered after the modification took place. When the modification is about to happen, an {{link|TStringList|OnChanging}} event occurs.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Following example tracks changes made to the list.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  s: TStringList;&lt;br /&gt;
  Count1,Count2: integer;&lt;br /&gt;
&lt;br /&gt;
procedure Before(Sender: TObject);&lt;br /&gt;
begin&lt;br /&gt;
  Count1 := TStringList(Sender).Count;&lt;br /&gt;
end;&lt;br /&gt;
&lt;br /&gt;
procedure After(Sender: TObject);&lt;br /&gt;
begin&lt;br /&gt;
  Count2 := TStringList(Sender).Count;&lt;br /&gt;
  &lt;br /&gt;
  if Count2 &amp;gt; Count1 then&lt;br /&gt;
    WriteLn('String added')&lt;br /&gt;
  else if Count2 &amp;lt; Count1 then&lt;br /&gt;
    WriteLn('String removed')&lt;br /&gt;
  else&lt;br /&gt;
    WriteLn('Content modified or moved');&lt;br /&gt;
end;  &lt;br /&gt;
  &lt;br /&gt;
begin&lt;br /&gt;
  s := File.CreateStringList();&lt;br /&gt;
&lt;br /&gt;
  s.OnChanging := @Before;&lt;br /&gt;
  s.OnChange := @After;&lt;br /&gt;
  &lt;br /&gt;
  s.Add('a');   // String added&lt;br /&gt;
  s.Add('b');   // String added&lt;br /&gt;
  s.Delete(1);  // String removed&lt;br /&gt;
  s[0] := 'a2'; // String modified or moved&lt;br /&gt;
  &lt;br /&gt;
  s.Free;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:TStringList]]&lt;/div&gt;</summary>
		<author><name>Mighty</name></author>	</entry>

	</feed>