Код программы. Вывод основных уведомлений, страница 5

//--------------------------------------------------------------------------void __fastcall TFtem::FormClose(TObject *Sender, TCloseAction &Action)

{

if (!Ftest->end) {

Fttest->Close();

}

}

//---------------------------------------------------------------------------


Ttest

//--------------------------------------------------------------------------#include <vcl.h>

#pragma hdrstop

#include "Ttest.h"

#include "Res.h"

#include "Unit2.h"

#include "Tem.h"

//--------------------------------------------------------------------------#pragma package(smart_init)

#pragma link "RzLabel"

#pragma link "RzPanel"

#pragma link "RzRadGrp"

#pragma link "RzButton"

#pragma link "IBCustomDataSet"

#pragma link "IBQuery"

#pragma resource "*.dfm"

TFttest *Fttest;

//--------------------------------------------------------------------------__fastcall TFttest::TFttest(TComponent* Owner)

: TForm(Owner)

{

}

//--------------------------------------------------------------------------void __fastcall TFttest::RzBitBtn1Click(TObject *Sender)

{

// Выбираем темы шаблонов

int kd = Type_Group->ItemIndex;

if (kd == 2) {

kd = 0;

}

id1.temp_type = Type_Group->ItemIndex;

id1.type_shabl = kd;

if (Type_Group->ItemIndex == 2) {

Ftem->Type_SR->Visible = true;

Ftem->Type_SR->ItemIndex = 0;

}

else {

Ftem->Type_SR->Visible = false;

Ftem->Type_SR->ItemIndex = -1;

}

if (Type_Group->ItemIndex == 3) {

return;

}

AnsiString fil, fil2, nazv;

int kod_v;

fil2 = "select * from \"Vids\" where \"Tema\" = "+IntToStr(kd);

vidy1->Close();

vidy1->SQL->Clear();

vidy1->SQL->Add(fil2);

vidy1->Open();

vidy1->First();

fil = "select * from \"Tems\" where \"Kod\" = "+IntToStr(kd)+" and \"Vid\" = "+IntToStr(vidy1Sh->AsInteger);

nazv1->Close();

nazv1->SQL->Clear();

nazv1->SQL->Add(fil);

nazv1->Open();

nazv1->First();

TLocateOptions Opts;

Opts.Clear();

Opts << loCaseInsensitive;

nazv1->Locate("Sh", id1.tema_shabl, Opts);

Ftem->Vids->Clear();

if (vidy1->RecordCount != 0) {

while (!vidy1->Eof) {

Ftem->Vids->AddItemValue(vidy1Naim->AsString, vidy1Sh->AsString);

if (nazv1Vid->AsInteger == vidy1Sh->AsInteger) {

nazv = vidy1Naim->AsString;

kod_v = vidy1Sh->AsInteger;

}

vidy1->Next();

}

Ftem->Vids->Enabled = true;

}

else

Ftem->Vids->Enabled = false;

Ftem->Vids->ItemIndex = 0;

vidy1->Close();

fil = "select * from \"Tems\" where \"Kod\" = "+IntToStr(kd)+" and \"Vid\" = "+IntToStr(kod_v);

nazv1->Close();

nazv1->SQL->Clear();

nazv1->SQL->Add(fil);

nazv1->Open();

nazv1->First();

TLocateOptions Opts1;

Opts1.Clear();

Opts1 << loCaseInsensitive;

nazv1->Locate("Sh", id1.tema_shabl, Opts1);

Ftem->Vids->ItemIndex = Ftem->Vids->IndexOf(nazv);

Ftest->id.type_shabl = kd;

if (nazv1->RecordCount <= 0) {

Application->MessageBoxA("Для выбранного типа тестирования отсутствуют темы!", "Работа с шаблонами", MB_OK + MB_ICONSTOP);

return;

}

else {

Fttest->Hide();

Ftem->Show();

}

}

//--------------------------------------------------------------------------void __fastcall TFttest::FormActivate(TObject *Sender)

{

// Соединяемся с БД

Ftest->id.db_path = Ftest->id.ReadFString(0, GetCurrentDir()+"\\config.inf");

Ftest->id.db_path += "\\ITSYSTEM.GDB";

Ftest->id.db_user = Ftest->id.ReadFString(2, GetCurrentDir()+"\\config.inf");

Ftest->id.db_pass = Ftest->id.ReadFString(3, GetCurrentDir()+"\\config.inf");