
- •Void __fastcall tForm1::FormCreate(tObject *Sender)
- •Void __fastcall tForm1::bCloseClick(tObject *Sender)
- •Void __fastcall tForm1::FormCreate(tObject *Sender)
- •Void __fastcall tForm1::bCloseClick(tObject *Sender)
- •Void __fastcall tForm1::RadioGroup1Click(tObject *Sender)
- •Void __fastcall tForm1::FormCreate(tObject *Sender)
- •Void __fastcall tForm1::bCloseClick(tObject *Sender)
- •Void __fastcall tForm1::RadioGroup1Click(tObject *Sender)
- •Void __fastcall tForm1::FormCreate(tObject *Sender)
Void __fastcall tForm1::FormCreate(tObject *Sender)
{
tSpisok->Open();
KolichStud();
}
//---------------------------------------------------------------------------
Void __fastcall tForm1::bCloseClick(tObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
Void __fastcall tForm1::RadioGroup1Click(tObject *Sender)
{ switch (RadioGroup1->ItemIndex)
{ case 0:{tSpisok->IndexName="";break;}
case 1:tSpisok->IndexName="indSpisokFIO";break;
case 2:tSpisok->IndexName="indSpisokGodPost";break;
case 3:tSpisok->IndexName="indSpisokGodRoj";break;
case 4:tSpisok->IndexName="indSpisokSredBall";break;
case 5:tSpisok->IndexName="indSpisokSpec";break;
}//конец switch
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int NewShifr;
Panel1->Show();Panel2->Hide();
tSpisok->IndexName="";//устанавливаем главный индекс, чтобы получить значение //наибольшего шифра
tSpisok->Last();//наибольший шифр в последней записи
NewShifr=tSpisok->FieldByName("Shifr")->AsInteger+1;
Edit1->Text=IntToStr(NewShifr);//записали новый уникальный шифр в Edit1
// очищаем остальные окна ввода
Edit2->Text="";Edit3->Text="0";Edit4->Text="0";
tSpisok->Insert();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
{ Panel1->Hide();Panel2->Show();
tSpisok->Edit();
Edit5->Text=tSpisok->FieldByName("Shifr")->AsString;
Edit6->Text=tSpisok->FieldByName("FIO")->AsString;
Edit7->Text=tSpisok->FieldByName("GodPost")->AsString;
Edit8->Text=tSpisok->FieldByName("GodRoj")->AsString;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
tSpisok->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
tSpisok->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
tSpisok->FieldByName("Shifr")->AsString=Edit1->Text;
tSpisok->FieldByName("FIO")->AsString= Edit2->Text;
tSpisok->FieldByName("GodPost")->AsString= Edit3->Text;
tSpisok->FieldByName("GodRoj")->AsString= Edit4->Text;
tSpisok->Post();
KolichStud();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
tSpisok->FieldByName("Shifr")->AsString=Edit5->Text;
tSpisok->FieldByName("FIO")->AsString= Edit6->Text;
tSpisok->FieldByName("GodPost")->AsString= Edit7->Text;
tSpisok->FieldByName("GodRoj")->AsString= Edit8->Text;
tSpisok->Post();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if ( MessageDlg("Подтвердите удаление записи\n "+tSpisok->FieldByName("FIO")->AsString,
mtConfirmation, TMsgDlgButtons()<< mbYes<< mbNo,0)==mrYes)
{ tSpisok->Delete();Beep();}
KolichStud();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit3KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0')&&(Key<='9'))||(Key==8)) return;
else Key=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit4KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0')&&(Key<='9'))||(Key==8)) return;
else Key=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit7KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0')&&(Key<='9'))||(Key==8)) return;
else Key=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit8KeyPress(TObject *Sender, char &Key)
{
if (((Key>='0')&&(Key<='9'))||(Key==8)) return;
else Key=0;
}
//---------------------------------------------------------------------------
Лабораторная работа №8
Внешний вид формы программы:
Листинг кода :
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
AnsiString ModeTSyn;
TForm1 *Form1;
void ShowKol()
{Form1->lKol->Caption="Всего фото "+IntToStr(Form1->tVid->RecordCount);
}
void ShowButtons()
{Form1->bDob->Show();Form1->bZam->Show();Form1->bUd->Show();Form1->bP->Show();
}
void HideButtons()
{Form1->bDob->Hide();Form1->bZam->Hide();Form1->bUd->Hide();Form1->bP->Hide();
}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------