Код:
procedure TForm1.TabControl1Changing(Sender: TObject; var AllowChange: Boolean);
Var s:String;
i:Integer;
B:Boolean;
begin
if DirectoryExists(s)=false then CreateDir(ExtractFileDir(Application.ExeName)+'\~VremFiles');
s:=GetTempDir;
RichEdit1.Lines.SaveToFile(s+'~'+TabControl1.Tabs.Strings[TabControl1.TabIndex]+' LРР.$$$');
ListBox1.Items.Add('');
b:=false;
for I := 0 to ListBox1.Items.Count-1 do
if ListBox1.Items.Strings[i] = '~'+TabControl1.Tabs.Strings[TabControl1.TabIndex]+' LРР.$$$' then
b:=False;
ListBox1.Items.Delete(ListBox1.Items.Count-1);
if b=true then begin
ListBox1.Items.Add('~'+TabControl1.Tabs.Strings[TabControl1.TabIndex]+' LРР.$$$');
ListBox2.Items.Add('X = '+IntToStr(RichEdit1.CaretPos.X)+';Y = '+IntToStr(RichEdit1.CaretPos.Y));
end;
RichEdit1.Clear;
end;
При таком раскладе он вообще не добавлет в Лист бокс ничего хотя лист бокс первоначально пустой