![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
||||
|
||||
|
Вот код
Код:
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;Проблема в том что в лист бокс нужно добавлять файл не попорядку тоесть если уже такой временный файл существует то имя временного файла в лист бокс не нужно добавлять. Скажите почему при этой проверки все равно добавление в лист бокс идет по порядку. И как это можно исправить. |
|
#2
|
|||
|
|||
|
наверно здесь
Код:
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; надо Код:
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; И кроме того, в методах формы TForm1 не используй переменную Form1 |
| Этот пользователь сказал Спасибо icWasya за это полезное сообщение: | ||
AlexandrV (24.07.2013)
| ||
|
#3
|
||||
|
||||
|
Код:
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;При таком раскладе он вообще не добавлет в Лист бокс ничего хотя лист бокс первоначально пустой |
|
#4
|
||||
|
||||
|
Ты ошибку допустил вот здесь
Код:
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; |