Смекни!
smekni.com

Разработка базы данных флагов мира (стр. 5 из 5)

end

else

begin

MessageDlg('ßçûê '''+eLanguage.Text+''' óæå ñóùåñòâóåò â òàáëèöå ÿçûêîâ',mtWarning,[mbOk],0);

eLanguage.SelectAll;

eLanguage.SetFocus;

end;

end;

procedure TfrmNewLanguage.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if key = vk_Escape then frmNewLanguage.Close;

end;

end.


Приложение Е

Файл реализации модуля “View.pas”

unit View;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls, ExtCtrls, ComCtrls, DBCtrls;

type

TfrmView = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

eCountry: TEdit;

eCapital: TEdit;

eKontinent: TEdit;

eLanguage1: TEdit;

eLanguage2: TEdit;

eLanguage3: TEdit;

DBImage1: TDBImage;

DBRichEdit1: TDBRichEdit;

procedure FormShow(Sender: TObject);

procedure FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

private

{ Private declarations }

public

{ Public declarations }

end;

var

frmView: TfrmView;

implementation

uses Module;

{$R *.DFM}

procedure TfrmView.FormShow(Sender: TObject);

var myStream: TMemoryStream;

begin

//ñòèðàþ âñå äàííûå íà ôîðìå

eKontinent.Clear;

eLanguage1.Clear;

eLanguage2.Clear;

eLanguage3.Clear;

eCapital.Clear;

eCountry.Clear;

eKontinent.Text := DM.tbKontinentKontinent.Value;

//íàõîäèì âñå ãîñóäàðñòâåííûå ÿçûêè

DM.qWork.SQL.Clear;

DM.qWork.SQL.Add('Select Language from Language where ID in (Select ID_Language from Main where ID_Country in (Select ID from Country where Country = '''+DM.tbCountryCountry.Value+'''))');

DM.qWork.Open;

eLanguage1.Text := DM.qWork.FieldByName('Language').Text;

if DM.qWork.RecordCount >= 2 then

begin

DM.qWork.Next;

eLanguage2.Text := DM.qWork.FieldByName('Language').Text;

end;

if DM.qWork.RecordCount = 3 then

begin

DM.qWork.Next;

eLanguage3.Text := DM.qWork.FieldByName('Language').Text;

end;

DM.qWork.Close;

eCountry.Text := DM.tbCountryCountry.Text;

eCapital.Text := DM.tbCountryCapital.Text;

end;

procedure TfrmView.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if key = VK_Escape then frmView.Close;

end;

end.