unit U_RoomParams; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, cxLookAndFeelPainters, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxSpinEdit, cxButtons; type TF_RoomParams = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; bDefault: TcxButton; bOK: TcxButton; bCancel: TcxButton; Label4: TLabel; edRoomHeight: TcxMaskEdit; edFalseFloorHeight: TcxMaskEdit; edConnHeight: TcxMaskEdit; edLineHeight: TcxMaskEdit; procedure bDefaultClick(Sender: TObject); procedure bCancelClick(Sender: TObject); procedure bOKClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure edRoomHeightKeyPress(Sender: TObject; var Key: Char); procedure edFalseFloorHeightKeyPress(Sender: TObject; var Key: Char); procedure edConnHeightKeyPress(Sender: TObject; var Key: Char); procedure edLineHeightKeyPress(Sender: TObject; var Key: Char); procedure edRoomHeightExit(Sender: TObject); procedure edFalseFloorHeightExit(Sender: TObject); procedure edConnHeightExit(Sender: TObject); procedure edLineHeightExit(Sender: TObject); private { Private declarations } public CurrentRoomHeight: string; CurrentFalseFloorHeight: string; CurrentConnHeight: string; CurrentLineHeight: string; { Public declarations } end; var F_RoomParams: TF_RoomParams; implementation uses USCS_Main, U_CAD, U_Common; {$R *.dfm} procedure TF_RoomParams.bDefaultClick(Sender: TObject); begin edRoomHeight.Text := FloatToStr(GRoomHeight);; edFalseFloorHeight.Text := FloatToStr(GFalseFloorHeight); edConnHeight.Text := FloatToStr(GConnHeight); edLineHeight.Text := FloatToStr(GLineHeight); end; procedure TF_RoomParams.bCancelClick(Sender: TObject); begin Close; end; procedure TF_RoomParams.bOKClick(Sender: TObject); begin try GCadForm.FRoomHeight := StrToFloat_My(edRoomHeight.Text); GCadForm.FFalseFloorHeight := StrToFloat_My(edFalseFloorHeight.Text); GCadForm.FConnHeight := StrToFloat_My(edConnHeight.Text); GCadForm.FLineHeight := StrToFloat_My(edLineHeight.Text); except edLineHeight.Text := FloatToStr(GLineHeight); end; end; procedure TF_RoomParams.FormShow(Sender: TObject); begin edRoomHeight.Text := FloatToStr(GCadForm.FRoomHeight); edFalseFloorHeight.Text := FloatToStr(GCadForm.FFalseFloorHeight); edConnHeight.Text := FloatToStr(GCadForm.FConnHeight); edLineHeight.Text := FloatToStr(GCadForm.FLineHeight); CurrentRoomHeight := edRoomHeight.Text; CurrentFalseFloorHeight := edFalseFloorHeight.Text; CurrentConnHeight := edConnHeight.Text; CurrentLineHeight := edLineHeight.Text; bOK.SetFocus; end; procedure TF_RoomParams.FormKeyPress(Sender: TObject; var Key: Char); begin if Key = #27 then Close; end; procedure TF_RoomParams.edRoomHeightKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin bOK.SetFocus; bOK.Click; end; end; procedure TF_RoomParams.edFalseFloorHeightKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin bOK.SetFocus; bOK.Click; end; end; procedure TF_RoomParams.edConnHeightKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin bOK.SetFocus; bOK.Click; end; end; procedure TF_RoomParams.edLineHeightKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin bOK.SetFocus; bOK.Click; end; end; procedure TF_RoomParams.edRoomHeightExit(Sender: TObject); begin if edRoomHeight.Text = '' then edRoomHeight.Text := CurrentRoomHeight; end; procedure TF_RoomParams.edFalseFloorHeightExit(Sender: TObject); begin if edFalseFloorHeight.Text = '' then edFalseFloorHeight.Text := CurrentFalseFloorHeight; end; procedure TF_RoomParams.edConnHeightExit(Sender: TObject); begin if edConnHeight.Text = '' then edConnHeight.Text := CurrentConnHeight; end; procedure TF_RoomParams.edLineHeightExit(Sender: TObject); begin if edLineHeight.Text = '' then edLineHeight.Text := CurrentLineHeight; end; end.