mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 22:45:39 +02:00
116 lines
2.9 KiB
ObjectPascal
116 lines
2.9 KiB
ObjectPascal
unit U_GridStep;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, cxControls,
|
|
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, siComp, siLngLnk, cxGraphics,
|
|
cxLookAndFeels, Menus;
|
|
|
|
type
|
|
TF_GridStep = class(TForm)
|
|
bOK: TcxButton;
|
|
bCancel: TcxButton;
|
|
edStepGrid: TcxMaskEdit;
|
|
Label1: TLabel;
|
|
lng_Forms: TsiLangLinked;
|
|
procedure bCancelClick(Sender: TObject);
|
|
procedure bOKClick(Sender: TObject);
|
|
procedure edStepGridKeyPress(Sender: TObject; var Key: Char);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
|
procedure edStepGridExit(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
CurrentGridStep: string;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
F_GridStep: TF_GridStep;
|
|
|
|
implementation
|
|
uses USCS_Main, U_CAD, U_Common, U_BaseCommon, U_Constants;
|
|
{$R *.dfm}
|
|
|
|
procedure TF_GridStep.bCancelClick(Sender: TObject);
|
|
begin
|
|
try
|
|
Close;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.bCancelClick', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_GridStep.bOKClick(Sender: TObject);
|
|
var
|
|
Val: Double;
|
|
begin
|
|
try
|
|
Val := StrToFloat_My(edStepGrid.Text);
|
|
if Val = 0 then
|
|
Val := 0.1;
|
|
GCadForm.PCad.GridStep := Val;
|
|
if not GProjectChanged then // Tolik 28/08/2019 --
|
|
SetProjectChanged(True);
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.bOKClick', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_GridStep.edStepGridKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
try
|
|
if (Key = '.') or (Key = ',') then
|
|
if Key <> DecimalSeparator then
|
|
Key := #0;
|
|
|
|
if Key = #13 then
|
|
begin
|
|
bOK.SetFocus;
|
|
bOK.Click;
|
|
end;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.edStepGridKeyPress', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_GridStep.FormShow(Sender: TObject);
|
|
begin
|
|
try
|
|
// EditMask
|
|
edStepGrid.Properties.EditMask := '[0-4]' + DecimalSeparator + '[1-9]|[1-5]' + DecimalSeparator + '[0]';
|
|
edStepGrid.Text := FormatFloat(ffMask, GCadForm.PCad.GridStep);
|
|
CurrentGridStep := edStepGrid.Text;
|
|
edStepGrid.SetFocus;
|
|
edStepGrid.SelStart := 0;
|
|
edStepGrid.SelLength := Length(edStepGrid.Text) + 1;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.FormShow', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_GridStep.FormKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
try
|
|
if Key = #27 then
|
|
Close;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.FormKeyPress', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_GridStep.edStepGridExit(Sender: TObject);
|
|
begin
|
|
try
|
|
if edStepGrid.Text = '' then
|
|
edStepGrid.Text := CurrentGridStep;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_GridStep.edStepGridExit', E.Message);
|
|
end;
|
|
end;
|
|
|
|
end.
|