Вот код
Код:
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
TSpinEdit_Change_And_Click;
end;
procedure TForm1.TabControl1Change(Sender: TObject);
var i:Integer;
s,s1,s2:String;
begin
s:=ExtractFileDir(Application.ExeName)+'\~VremFiles\';
for I := 0 to Form1.ListBox1.Items.Count-1 do
If Form1.ListBox1.Items.Strings[i] = '~'+Form1.TabControl1.Tabs.Strings[Form1.TabControl1.TabIndex]+' LРР.$$$' then begin
Form1.RichEdit1.Lines.LoadFromFile(s+Form1.ListBox1.Items.Strings[i]);
s1:=Form1.ListBox2.Items.Strings[i];
Delete(S1,Pos(';',s1),Length(S1));
s1:=s1;
s2:=Form1.ListBox2.Items.Strings[i];
Delete(S2,Length(s2),Pos(';',s2)-1);
s2:=s2;
end;
end;
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:=ExtractFileDir(Application.ExeName)+'\~VremFiles\';
Form1.RichEdit1.Lines.SaveToFile(s+'~'+Form1.TabControl1.Tabs.Strings[Form1.TabControl1.TabIndex]+' LРР.$$$');
Form1.ListBox1.Items.Add('');
for I := 0 to Form1.ListBox1.Items.Count-1 do
if Form1.ListBox1.Items.Strings[i]<>'~'+Form1.TabControl1.Tabs.Strings[Form1.TabControl1.TabIndex]+' LРР.$$$' then
b:=True else b:=False;
Form1.ListBox1.Items.Delete(Form1.ListBox1.Items.Count-1);
if b=true then begin
Form1.ListBox1.Items.Add('~'+Form1.TabControl1.Tabs.Strings[Form1.TabControl1.TabIndex]+' LРР.$$$');
Form1.ListBox2.Items.Add('X = '+IntToStr(Form1.RichEdit1.CaretPos.X)+';Y = '+IntToStr(Form1.RichEdit1.CaretPos.Y));
end;
Form1.RichEdit1.Clear;
end;
procedure TForm1.TSpinEdit_Change_And_Click;
Var procent1,procent2,procent3:Extended;
begin
procent1:=Form1.SpinEdit1.Max;
procent2:=Form1.SpinEdit1.Value;
procent3:=(procent2*100) / procent1;
Form1.Gauge1.Progress:=Round(procent3);
Form1.TabControl1.Tabs.Add(Inttostr(Round(Form1.SpinEdit1.Value))+' '+DynamicLang[8]);
If Form1.TabControl1.Tabs.Count > Round(form1.SpinEdit1.Value) then
repeat
Form1.TabControl1.Tabs.Delete(Form1.TabControl1.Tabs.Count-1);
until Form1.TabControl1.Tabs.Count = Round(Form1.SpinEdit1.Value);
end;
Проблема в том что в лист бокс нужно добавлять файл не попорядку тоесть если уже такой временный файл существует то имя временного файла в лист бокс не нужно добавлять. Скажите почему при этой проверки все равно добавление в лист бокс идет по порядку. И как это можно исправить.