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

#pragma link "RzRadGrp"

#pragma link "RzRadChk"

#pragma resource "*.dfm"

TFrame2 *Frame2;

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

: TFrame(Owner)

{

}

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

{

Form1->Frame21->Visible=false;

Form1->Frame11->Visible=true;

}

//--------------------------------------------------------------------------void __fastcall TFrame2::RzBitBtn2Click(TObject *Sender)

{

// Выбираем тип шаблона и подгружаем тему для него

int kd = Type_Group->ItemIndex;

if (kd == 2) {

kd = 0;

}

Form1->id.temp_type = Type_Group->ItemIndex;

Form1->id.type_shabl = kd;

Form1->Frame71->Ltshabl->Caption = Type_Group->Items->ValueFromIndex[kd];

if (Type_Group->ItemIndex == 2) {

Form1->Frame31->Type_SR->Visible = true;

Form1->Frame31->Type_SR->ItemIndex = 0;

}

else {

Form1->Frame31->Type_SR->Visible = false;

Form1->Frame31->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);

Form1->vidy->Close();

Form1->vidy->SQL->Clear();

Form1->vidy->SQL->Add(fil2);

Form1->vidy->Open();

Form1->vidy->First();

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

Form1->nazv->Close();

Form1->nazv->SQL->Clear();

Form1->nazv->SQL->Add(fil);

Form1->nazv->Open();

Form1->nazv->First();

TLocateOptions Opts;

Opts.Clear();

Opts << loCaseInsensitive;

Form1->nazv->Locate("Sh", Form1->id.tema_shabl, Opts);

Form1->Frame31->Vids->Clear();

if (Form1->vidy->RecordCount != 0) {

while (!Form1->vidy->Eof) {

Form1->Frame31->Vids->AddItemValue(Form1->vidyNaim->AsString, Form1->vidySh->AsString);

if (Form1->nazvVid->AsInteger == Form1->vidySh->AsInteger) {

nazv = Form1->vidyNaim->AsString;

kod_v = Form1->vidySh->AsInteger;

}

Form1->vidy->Next();

}

Form1->Frame31->Vids->Enabled = true;

}

else

Form1->Frame31->Vids->Enabled = false;

Form1->Frame31->Vids->ItemIndex = 0;

Form1->vidy->Close();

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

Form1->nazv->Close();

Form1->nazv->SQL->Clear();

Form1->nazv->SQL->Add(fil);

Form1->nazv->Open();

Form1->nazv->First();

TLocateOptions Opts1;

Opts1.Clear();

Opts1 << loCaseInsensitive;

Form1->nazv->Locate("Sh", Form1->id.tema_shabl, Opts1);

Form1->Frame31->Vids->ItemIndex = Form1->Frame31->Vids->IndexOf(nazv);

if (Form1->nazv->RecordCount <= 0) {

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

return;

}

else {

Form1->Frame21->Visible = false;

Form1->Frame31->Visible = true;

}

}

//--------------------------------------------------------------------------Папка “Main\Units” Unit3

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

#pragma hdrstop

#include "Unit3.h"

#include "Main.h"

#include "Unit2.h"

#include "Unit4.h"

#include "Unit7.h"

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