Смекни!
smekni.com

Исследование и моделирование с помощью компьютера электрических полей (стр. 4 из 4)

Button1: TButton;

Label1: TLabel;

SpinEdit1: TSpinEdit;

TabSheet2: TTabSheet;

Label2: TLabel;

Edit1: TEdit;

Label3: TLabel;

Label4: TLabel;

Bevel1: TBevel;

Label5: TLabel;

Edit2: TEdit;

Label6: TLabel;

Label7: TLabel;

ComboBox1: TComboBox;

Image1: TImage;

Edit3: TEdit;

Bevel2: TBevel;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

Panel1: TPanel;

RadioButton3: TRadioButton;

RadioButton4: TRadioButton;

CheckBox1: TCheckBox;

CheckBox2: TCheckBox;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure RadioButton2Click(Sender: TObject);

procedure RadioButton1Click(Sender: TObject);

procedure RadioButton3Click(Sender: TObject);

procedure RadioButton4Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

type Table=record

Name:String[30];

Di:Real;

end;

var

Form2: TForm2;

F:Text;

Tab:Array of Table;

implementation

uses Main;

{$R *.DFM}

procedure TForm2.Button1Click(Sender: TObject);

begin

Z:=SpinEdit1.Value;

Form2.Close;

end;

procedure TForm2.FormCreate(Sender: TObject);

Var S:String;

I,P:Integer;

begin

Z:=SpinEdit1.Value; I:=0;

AssignFile(F,'dielectr.dat'); Reset(F);

SetLength(Tab,1);

While not Eof(F) do begin

Readln(F,S); SetLength(Tab,Length(Tab)+1);Inc(I);

Tab[I].Name:=Copy(S,1,Pos('$',S)-1);

Delete(S,1,Pos('$',S));

Tab[I].Di:=StrToFloat(S);

end;

CloseFile(F);

For P:=1 to I do ComboBox1.Items.Add(Tab[P].Name);

end;

procedure TForm2.ComboBox1Change(Sender: TObject);

Var I:Integer;

begin

For I:=1 to Length(Tab) do If ComboBox1.Text=Tab[I].Name then begin

Edit3.Text:=FloatToStr(Tab[I].Di); Break; End;

end;

procedure TForm2.RadioButton2Click(Sender: TObject);

begin

Edit3.Enabled:=True;

ComboBox1.Enabled:=False;

ComboBox1.Text:='Другая...';

end;

procedure TForm2.RadioButton1Click(Sender: TObject);

begin

Edit3.Enabled:=False;

ComboBox1.Enabled:=True;

end;

procedure TForm2.RadioButton3Click(Sender: TObject);

begin

CheckBox1.Enabled:=False;

CheckBox2.Enabled:=False;

end;

procedure TForm2.RadioButton4Click(Sender: TObject);

begin

CheckBox1.Enabled:=True;

CheckBox2.Enabled:=True;

end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);

begin

If (StrToFloat(Edit1.Text)=0) or

(StrToFloat(Edit2.Text)=0) then begin

Application.MessageBox('Некорректно введены некоторые данные','Ошибка данных',mb_iconstop);

end;

end;

end.


Модуль Calc.pas


unit Calc;

interface

uses

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

ExtCtrls, StdCtrls;

type

TForm3 = class(TForm)

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

{$R *.DFM}

end.


Модуль About.pas


unit About;

interface

uses

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

StdCtrls, ExtCtrls, RXCtrls, ComCtrls;

type

TForm4 = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

SecretPanel1: TSecretPanel;

Label1: TLabel;

Label2: TLabel;

Image1: TImage;

procedure TabSheet1Exit(Sender: TObject);

procedure TabSheet1Enter(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

{$R *.DFM}

procedure TForm4.TabSheet1Exit(Sender: TObject);

begin

SecretPanel1.Active:=False;

end;

procedure TForm4.TabSheet1Enter(Sender: TObject);

begin

SecretPanel1.Active:=True;

end;

end.