Большое спасибо за советы!
Вот думаю большая проблема может быть в это: у меня при активации формы очень много кода используется! Я так понимаю что при каждом обращении к форме используется этот код! Но как бы сделать что бы это происходило тока при запуске программы и далее он исполнялся!!??
Вот код:
Код:
procedure TMenu.FormActivate(Sender: TObject);
const
rem_login = 'C:\WINDOWS\system32\rem_login.txt';
var
f : TStrings;
begin
if FileExists(rem_login) then
begin
f := TStringList.Create();
f.LoadFromFile(rem_login);
if f.Count <= 0 then
begin
/
if flag_2 = false
then Auth.showmodal;
end
else if f.Count > 0 then
begin
temp_s := f.Strings[2];
end;
f.Free;
if vis = true
then bitbtn1click(sender);
if (temp_s = '0') then begin showmessage('Ó âàñ íåò äîñòóïà ê äàííûì - âû çàáëîêèðîâàíû!!! Îøèáêà ¹5'); close; end
else if (temp_s = '1') then
begin
button5.Enabled := false;
AReview.button5.Enabled := false;
SArenda.button5.Enabled := false;
PReview.button5.Enabled := false;
SProdag.button5.Enabled := false;
button3.Enabled := false;
AReview.button3.Enabled := false;
SArenda.button3.Enabled := false;
PReview.button3.Enabled := false;
SProdag.button3.Enabled := false;
n7.Enabled := false;
AReview.n7.Enabled := false;
SArenda.n7.Enabled := false;
PReview.n7.Enabled := false;
SProdag.n7.Enabled := false;
n12.Enabled := false;
AReview.n12.Enabled := false;
SArenda.n12.Enabled := false;
PReview.n12.Enabled := false;
SProdag.n12.Enabled := false;
with areview do
begin
datamodule2.DataQuery.Open;
f := TStringList.Create();
f.LoadFromFile('C:\Program Files\Lider\cols_size\A_cols_size.txt');
cxkod.Width := strtoint(f.Strings[0]);
cxCategory.Width := strtoint(f.Strings[1]);
cxRooms.Width := strtoint(f.Strings[2]);
cxPlan.Width := strtoint(f.Strings[3]);
cxCena.Width := strtoint(f.Strings[4]);
cxCenaM.Width := strtoint(f.Strings[5]);
cxValuta.Width := strtoint(f.Strings[6]);
cxDistrict.Width := strtoint(f.Strings[7]);
cxStreet.Width := strtoint(f.Strings[8]);
cxHouse.Width := strtoint(f.Strings[9]);
cxGula.Width := strtoint(f.Strings[10]);
cxKuhnia.Width := strtoint(f.Strings[11]);
cxEtag.Width := strtoint(f.Strings[12]);
cxEtagnost.Width := strtoint(f.Strings[13]);
cxMaterial.Width := strtoint(f.Strings[14]);
cxPhone.Width := strtoint(f.Strings[15]);
cxTV.Width := strtoint(f.Strings[16]);
cxHolod.Width := strtoint(f.Strings[17]);
cxMebel.Width := strtoint(f.Strings[18]);
cxPredoplata.Width := strtoint(f.Strings[19]);
cxKPhone.Width := strtoint(f.Strings[20]);
cxText.Width := strtoint(f.Strings[21]);
cxDate.Width := strtoint(f.Strings[22]);
f.Free;
label18.Caption := inttostr(cxArenda.DataController.RecordCount);
end;
with sarenda do
begin
with datamodule2 do
begin
with S_Arenda_Query do
begin
open;
end;
end;
f := TStringList.Create();
f.LoadFromFile('C:\Program Files\Lider\cols_size\SA_cols_size.txt');
Kod.Width := strtoint(f.Strings[0]);
Date.Width := strtoint(f.Strings[1]);
Text.Width := strtoint(f.Strings[2]);
f.Free;
label18.Caption := inttostr(cxGrid1DBTableView1.DataController.RecordCount);
end;
end
else if
(temp_s = '2') then
begin
end;
end
else if (temp_s = '3') then
begin
end;
end;
end
else
begin
showmessage('Íå íàéäåí îäèí èç ôàéëîâ ïðîãðàììû!!! Îøèáêà ¹6');
bitbtn1click(sender);
end;
end;