Prvotni verze pro Giteu
This commit is contained in:
187
frmCalc.pas
Normal file
187
frmCalc.pas
Normal file
@ -0,0 +1,187 @@
|
||||
unit frmCalc;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, AdvTouchKeyboard,
|
||||
Vcl.ExtCtrls;
|
||||
|
||||
type
|
||||
TformCalc = class(TForm)
|
||||
lblCalcPnl: TLabel;
|
||||
advKbd: TAdvTouchKeyboard;
|
||||
edtNum: TEdit;
|
||||
btnCalcPnlClose: TButton;
|
||||
procedure advKbdKeyClick(Sender: TObject; Index: Integer);
|
||||
procedure btnCalcPnlCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{
|
||||
procedure NastavMsgWin(b1Vis: Boolean; b2Vis: Boolean; b3Vis: Boolean; b1Res: Integer; b2Res: Integer; b3Res: Integer; timerInt: Integer; timerRes: Integer;
|
||||
b1Lbl: string; b2Lbl: string; b3Lbl: string; titulek: string; msg: string; memoMsg: string);
|
||||
}
|
||||
public
|
||||
pnlAkce, mrVal: integer;
|
||||
retVal: string;
|
||||
edtNumAlign: TAlignment;
|
||||
mnMax: Single;
|
||||
end;
|
||||
|
||||
var
|
||||
formCalc: TformCalc;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses System.StrUtils,
|
||||
datModul, funkceTB, frmMain;
|
||||
|
||||
|
||||
|
||||
{
|
||||
procedure TformCalc.NastavMsgWin(b1Vis: Boolean; b2Vis: Boolean; b3Vis: Boolean; b1Res: Integer; b2Res: Integer; b3Res: Integer; timerInt: Integer; timerRes: Integer;
|
||||
b1Lbl: string; b2Lbl: string; b3Lbl: string; titulek: string; msg: string; memoMsg: string);
|
||||
begin
|
||||
|
||||
end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
procedure TformCalc.advKbdKeyClick (Sender: TObject; Index: Integer);
|
||||
var i: integer;
|
||||
m, mnOdeslat, mnOK, mnZmIO, mnZmNeopr: Extended;
|
||||
msg: string;
|
||||
rI: Integer;
|
||||
rE: Extended;
|
||||
begin
|
||||
i:= -1;
|
||||
|
||||
if (RightStr(edtNum.Text.Trim,1)='"') and (Index<>10) and (Index<>11) and (Index<>13) then
|
||||
Exit;
|
||||
|
||||
case Index of
|
||||
10: begin // enter
|
||||
edtNum.Text:= Trim(edtNum.Text);
|
||||
|
||||
case pnlAkce of
|
||||
1,3,5: begin // osobni cislo / cislo nadoby / DN
|
||||
if not(TryStrToInt(edtNum.Text, rI)) then
|
||||
rI:= 0;
|
||||
retVal:= rI.ToString;
|
||||
end;
|
||||
2,7: begin
|
||||
if not(TryStrToFloat(edtNum.Text, rE)) then // mnozstvi do srotu (mm) / sila (tloustka)
|
||||
rE:= 0;
|
||||
retVal:= rE.ToString;
|
||||
end;
|
||||
4,6: retVal:= edtNum.Text; // material / prumer
|
||||
end;
|
||||
mrVal:= 0;
|
||||
Close;
|
||||
end;
|
||||
11: begin
|
||||
edtNum.Text:= LeftStr(edtNum.Text, Length(edtNum.Text)-1);
|
||||
// if (edtNum.Text='') then
|
||||
// edtNum.Text:= '0';
|
||||
end;
|
||||
12: if (edtNum.Text<>'') and (Pos(',', edtNum.Text)=0) then
|
||||
edtNum.Text:= edtNum.Text + ',';
|
||||
13: edtNum.Text:= '';
|
||||
else
|
||||
edtNum.Text:= edtNum.Text + advKbd.Keys[Index].Caption;
|
||||
end;
|
||||
if (Length(edtNum.Text)=2) and (edtNum.Text.LeftStr(1)='0') and (edtNum.Text<>'0.') then
|
||||
edtNum.Text:= RightStr(edtNum.Text, 1);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TformCalc.btnCalcPnlCloseClick (Sender: TObject);
|
||||
begin
|
||||
mrVal:= 10;
|
||||
Close;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TformCalc.FormCreate (Sender: TObject);
|
||||
begin
|
||||
self.Visible:= false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TformCalc.FormShow (Sender: TObject);
|
||||
begin
|
||||
Self.Left:= (Screen.WorkAreaWidth - self.Width) div 2;
|
||||
Self.Top:= (Screen.WorkAreaHeight - self.Height) div 2;
|
||||
|
||||
if (btnCalcPnlClose.CanFocus) then
|
||||
btnCalcPnlClose.SetFocus;
|
||||
|
||||
|
||||
// desetinna tecka
|
||||
advKbd.Keys.Items[12].Width:= 0;
|
||||
advKbd.Keys.Items[12].Height:= 0;
|
||||
|
||||
// znak "
|
||||
advKbd.Keys.Items[14].Width:= 0;
|
||||
advKbd.Keys.Items[14].Height:= 0;
|
||||
|
||||
|
||||
|
||||
if (pnlAkce=1) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'Osobní číslo zaměstnance:';
|
||||
end;
|
||||
|
||||
if (pnlAkce=2) then
|
||||
begin
|
||||
advKbd.Keys.Items[12].Width:= 100;
|
||||
advKbd.Keys.Items[12].Height:= 100;
|
||||
lblCalcPnl.Caption:= 'Množství do šrotu (mm)';
|
||||
end;
|
||||
|
||||
if (pnlAkce=3) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'Číslo nádoby';
|
||||
end;
|
||||
|
||||
if (pnlAkce=4) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'Materiál';
|
||||
end;
|
||||
|
||||
if (pnlAkce=5) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'DN';
|
||||
end;
|
||||
|
||||
if (pnlAkce=6) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'Průměr';
|
||||
advKbd.Keys.Items[12].Width:= 100; // desetinna tecka
|
||||
advKbd.Keys.Items[12].Height:= 100;
|
||||
advKbd.Keys.Items[14].Width:= 100; // znak "
|
||||
advKbd.Keys.Items[14].Height:= 100;
|
||||
end;
|
||||
|
||||
if (pnlAkce=7) then
|
||||
begin
|
||||
lblCalcPnl.Caption:= 'Síla (tloušťka)';
|
||||
advKbd.Keys.Items[12].Width:= 100; // desetinna tecka
|
||||
advKbd.Keys.Items[12].Height:= 100;
|
||||
advKbd.Keys.Items[14].Width:= 100; // znak "
|
||||
advKbd.Keys.Items[14].Height:= 100;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user