void __fastcall Tmain_Form::select_BitBtnClick(TObject *Sender)
{
if (pr_Query->Filtered) { // відмінарежимуфільтрації
pr_Query->Filtered = false;
select_BitBtn->Kind = bkYes;
select_BitBtn->Caption = "Поновитивідбір";
} else { // встановленнярежимуфільтрації
select_BitBtn->Kind = bkCancel;
select_BitBtn->Caption = "Відмінитивідбір";
minage_CSpinEditChange(Sender);
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_Form::pr_DBGridCellClick(TColumn *Column)
{
if (PageControl->ActivePage == TabEdit) {
chdp_ComboBox -> ItemIndex =
chdp_ComboBox->Items->IndexOf(pr_QueryDEP->AsString);
chfam_Edit->Text = pr_QueryFAM->AsString;
chname_Edit->Text = pr_QueryNAM->AsString;
chgrand_Edit->Text = pr_QueryPAR->AsString;
chyear_CSpinEdit->Value = pr_QueryYEAR_B->AsInteger;
if (pr_QuerySEX->AsString == "ч") sex2_RadioGroup->ItemIndex = 0;
else sex2_RadioGroup->ItemIndex = 1;
}
// поточнаперсона
CurrentPers = pr_QueryNUM->AsInteger;
pr_Label->Caption = IntToStr(CurrentPers);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_Form::Delay(unsigned long int mSeconds)
{ // затримканадекількамілісекунд
unsigned long int FirstTick;
FirstTick = GetTickCount();
do
Application->ProcessMessages();
while (GetTickCount() - FirstTick <= mSeconds);
}
Файл Udba.h
//---------------------------------------------------------------------------
#ifndef UdbaH
#define UdbaH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DBCtrls.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class Tcharacter_Form : public TForm
{
__published: // IDE-managed Components
TDBMemo *character_DBMemo;
TPanel *PPhoto;
TDBImage *photo_DBImage;
private: // User declarations
public: // User declarations
__fastcall Tcharacter_Form(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE Tcharacter_Form *character_Form;
//---------------------------------------------------------------------------
#endif
Файл Udba.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Udba.h"
#include "Udb.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tcharacter_Form *character_Form;
//---------------------------------------------------------------------------
__fastcall Tcharacter_Form::Tcharacter_Form(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
Длявиконанняприкладеннятребапопередньозавантажитинавиконанняприкладення-сервер IBServer.EXE, якезазвичайзнаходитьсязамаршрутом "E:\Program Files\InterBase Corp\InterBase\Bin\" іобслуговуєзапитидобазиданих Interbase. Після завантаження поточ-ного проекту на виконання цей сервер виводить на екран запит (мал.. 1.15) , у полі Password: якого треба ввести пароль доступу masterkey..
Малюнок 1.15
Форми під час функціонування прикладення наведено на мал. 1.16 - 1.18.
Малюнок 1.16
Малюнок 1.17
Малюнок 1.18
Вказівки до створення другого прикладення: Для маніпулювання таблицями можна використати корегований проект попереднього прикладення (мал. 1.19).
Малюнок 1.19
Головну форму main_Form наведено на мал. 1.20.
Малюнок 1.20
Текстовийописформи main_Form:
object main_Form: Tmain_Form
Left = 63
Top = 22
Width = 709
Height = 461
Caption = 'Лабораторнаробота 3'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'System'
Font.Style = [fsBold]
OldCreateOrder = True
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 16
object PageControl: TPageControl
Left = 421
Top = 0
Width = 280
Height = 429
ActivePage = find_TabSheet
Align = alClient
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
MultiLine = True
ParentFont = False
TabOrder = 0
OnChange = PageControlChange
object find_TabSheet: TTabSheet
Caption = 'Відбір'
object select_GroupBox: TGroupBox
Left = 1
Top = 5
Width = 268
Height = 212
Caption = 'Відбірза ...'
TabOrder = 7
end
object sex_RadioGroup: TRadioGroup
Left = 8
Top = 120
Width = 257
Height = 53
Caption = ' статтю'
Columns = 2
ItemIndex = 0
Items.Strings = (
'чоловіча'
'жіноча')
TabOrder = 0
OnClick = minage_CSpinEditChange
end
object speedfind_GroupBox: TGroupBox
Left = 0
Top = 224
Width = 257
Height = 169
Caption = ' Швидкийпошукзапрізвищем'
TabOrder = 5
object Image1: TImage
Left = 8
Top = 16
Width = 105
Height = 145
Picture.Data = {}
Stretch = True
end
object speedfind_Label: TLabel
Left = 154
Top = 50
Width = 56
Height = 16
Caption = 'Прізвище'
end
object speedfind_Image: TImage
Left = 32
Top = 48
Width = 57
Height = 73
Picture.Data = {}
Stretch = True
end
end
object age_GroupBox: TGroupBox
Left = 8
Top = 32
Width = 257
Height = 81
Caption = ' віком'
Enabled = False
TabOrder = 4
object minage_Label: TLabel
Left = 65
Top = 15
Width = 28
Height = 16
Caption = 'від ...'
end
object maxage_Label: TLabel
Left = 192
Top = 15
Width = 25
Height = 16
Caption = 'до ...'
end
object minage_Image: TImage
Left = 8
Top = 24
Width = 41
Height = 49
Picture.Data = {}
Stretch = True
Transparent = True
end
object maxage_Image: TImage
Left = 136
Top = 24
Width = 41
Height = 49
Picture.Data = {}
Stretch = True
Transparent = True
end
end
object speedfind_Edit: TEdit
Left = 120
Top = 310
Width = 129
Height = 22
Hint = 'Вводфамилии'
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnChange = speedfind_EditChange
end
object minage_CSpinEdit: TCSpinEdit
Left = 62
Top = 66
Width = 65
Height = 26
TabStop = True
MaxValue = 80
MinValue = 16
ParentColor = False
TabOrder = 2
Value = 16
OnChange = minage_CSpinEditChange
end
object maxage_CSpinEdit: TCSpinEdit
Left = 190
Top = 66
Width = 65
Height = 26
TabStop = True
MaxValue = 80
MinValue = 16
ParentColor = False
TabOrder = 3
Value = 30
OnChange = minage_CSpinEditChange
end
object select_BitBtn: TBitBtn
Left = 8
Top = 184
Width = 257
Height = 25
Cursor = crHandPoint
Caption = 'Поновитивідбір'
TabOrder = 6
OnClick = select_BitBtnClick
Kind = bkOK
end
end
object TabEdit: TTabSheet
Caption = 'Корегування'
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
object ch_GroupBox: TGroupBox
Left = 2
Top = 5
Width = 269
Height = 388
Caption = ' Загальнівідомості'
TabOrder = 9
object chdp_Label: TLabel
Left = 12
Top = 38
Width = 50
Height = 16
Caption = 'Відділок'
FocusControl = chdp_ComboBox
end
object chname_Label: TLabel
Left = 12
Top = 138
Width = 25
Height = 16
Caption = 'Ім'#39'я'
FocusControl = chname_Edit
end
object chgrand_Label: TLabel
Left = 12
Top = 188
Width = 73
Height = 16
Caption = 'Побатькові'
FocusControl = chgrand_Edit
end
object chyear_Label: TLabel
Left = 12
Top = 232
Width = 95
Height = 16
Caption = 'Рікнародження'
end
object chfam_Label: TLabel
Left = 12
Top = 87
Width = 56
Height = 16
Caption = 'Прізвище'
FocusControl = chfam_Edit
end
object oper_Bevel: TBevel
Left = 18
Top = 282
Width = 251
Height = 96
end
object oper_Shape: TShape
Left = 19
Top = 283
Width = 248
Height = 94
Brush.Color = clBlack
end
object Animate1: TAnimate
Left = 24
Top = 291
Width = 60
Height = 80
Active = True
FileName = 'Frage.avi'
StopFrame = 31
Transparent = False
end
end
object sex2_RadioGroup: TRadioGroup
Left = 185
Top = 218
Width = 77
Height = 41
Caption = 'Стать'
Columns = 2
ItemIndex = 0
Items.Strings = (
'ч'
'ж')
TabOrder = 4
end
object chdp_ComboBox: TComboBox
Left = 101
Top = 40
Width = 162
Height = 22
Style = csDropDownList
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ItemHeight = 14
ParentFont = False
TabOrder = 0
end
object chfam_Edit: TEdit
Left = 101
Top = 90
Width = 162
Height = 22
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
TabOrder = 1
Text = 'chfam_Edit'
end
object chname_Edit: TEdit
Left = 101
Top = 140
Width = 162
Height = 22
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
TabOrder = 2
Text = 'chname_Edit'
end
object chgrand_Edit: TEdit
Left = 101
Top = 190
Width = 162
Height = 22
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
TabOrder = 3
Text = 'chgrand_Edit'
end
object chadd_Button: TButton
Left = 88
Top = 294
Width = 169
Height = 25
Hint = 'Новаязапись'
Caption = '&Додати'
ParentShowHint = False
ShowHint = True
TabOrder = 5
OnClick = chadd_ButtonClick
end
object chdelete_Button: TButton
Left = 88
Top = 322
Width = 169
Height = 25
Hint = 'Удалениезаписи'
Caption = '&Видалити'
ParentShowHint = False
ShowHint = True
TabOrder = 6
OnClick = chdelete_ButtonClick
end
object chpost_Button: TButton
Left = 88
Top = 351
Width = 169
Height = 25
Hint = 'Фиксацияизменений'
Caption = '&Поновити'
ParentShowHint = False
ShowHint = True
TabOrder = 7
OnClick = chpost_ButtonClick
end
object chyear_CSpinEdit: TCSpinEdit
Left = 119
Top = 233
Width = 50
Height = 23
TabStop = True
Font.Charset = RUSSIAN_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
MaxValue = 2000
MinValue = 1900
ParentColor = False
ParentFont = False
TabOrder = 8
Value = 1950
end
end
end
object left_Panel: TPanel
Left = 0
Top = 0
Width = 421
Height = 429
Align = alLeft
BevelInner = bvLowered
Caption = 'left_Panel'
TabOrder = 1
object find_TPanel: TPanel
Left = 6
Top = 5
Width = 406
Height = 420
Caption = 'find_TPanel'
TabOrder = 1
object find_Label: TLabel
Left = 109
Top = 16
Width = 265
Height = 24
Alignment = taCenter
Caption = 'ПОШУКСПІВРОБІТНИКІВ'
Font.Charset = RUSSIAN_CHARSET
Font.Color = clRed
Font.Height = -21
Font.Name = 'Arial Cyr'
Font.Style = [fsBold, fsItalic]
ParentFont = False
end
object dp_GroupBox: TGroupBox
Left = 8
Top = 48
Width = 393
Height = 65
Caption = ' Відділок'
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = [fsBold, fsItalic]
ParentFont = False
TabOrder = 0
object dp_ComboBox: TComboBox
Left = 14
Top = 22
Width = 155
Height = 24
ItemHeight = 16
Items.Strings = (
'Бухгалтерия')
TabOrder = 0
OnChange = dp_ComboBoxChange
end
end
object dp2_GroupBox: TGroupBox
Left = 216
Top = 58
Width = 169
Height = 46
Caption = ' підрозділ'
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = [fsItalic]
ParentFont = False