unit Grenzen;
{Grenzen-Eingabe-Dialog}
interface
uses WinProcs,WinTypes,OWindows,ODialogs,
smsh,smsp;
const
ID_L=101;
ID_R=102;
ID_HWE=103;
ID_SPR=104;
ID_HV=105;
ID_MV=106;
ID_MA=107;
ID_Hilfe=3;
type
PGrenzenDlg=^TGrenzenDlg;
TGrenzenDlg=object(TDialog)
L,R,HWE: TReal; {Linker SWE, Rechter SWE, HWE}
SPR: TReal; {Schritte pro Umdrehung (alles einheitlich)}
HV,MV,MA: TReal; {Geschwindigkeiten und Beschleunigung}
procedure SetupWindow; virtual;
procedure IDHilfe(var Msg:TMessage); virtual ID_First+ID_Hilfe;
function CanClose:Boolean; virtual;
end;
implementation
procedure TGrenzenDlg.SetupWindow;
var
S: TS31; {kurzer String}
I: Integer;
begin
inherited SetupWindow;
L:=LeftBound;
R:=RightBound;
HWE:=RefPos;
SPR:=SchrittPU;
HV:=RefSpeed;
MV:=MoveSpeed;
MA:=MoveAccel;
Real2S(L,3,S);
SetDlgItemText(HWindow,ID_L,S);
Real2S(R,3,S);
SetDlgItemText(HWindow,ID_R,S);
Real2S(HWE,3,S);
SetDlgItemText(HWindow,ID_HWE,S);
Real2S(SPR,1,S);
SetDlgItemText(HWindow,ID_SPR,S);
Real2S(HV,1,S);
SetDlgItemText(HWindow,ID_HV,S);
Real2S(MV,1,S);
SetDlgItemText(HWindow,ID_MV,S);
Real2S(MA,1,S);
SetDlgItemText(HWindow,ID_MA,S);
end;
procedure TGrenzenDlg.IDHilfe(var Msg:TMessage);
var
S: TS31;
begin
WinHelp(HWindow,HelpFileName,HELP_Context,ID_Grenzen);
end;
function TGrenzenDlg.CanClose:Boolean;
var
S: TS31;
Z: Real;
I: Integer;
begin
if GetReal(HWindow,ID_L,L)
and GetReal(HWindow,ID_R,R)
and GetReal(HWindow,ID_HWE,HWE)
and GetReal(HWindow,ID_SPR,SPR)
and GetReal(HWindow,ID_HV,HV)
and GetReal(HWindow,ID_MV,MV)
and GetReal(HWindow,ID_MA,MA)
and (L<=HWE)
and (HWE<=R)
and (Round(SPR)<>0) {Negatives Vorzeichen kehrt Richtung um!}
then begin
LeftBound:=L;
RightBound:=R;
RefPos:=HWE;
SchrittPU:=SPR;
RefSpeed:=HV;
MoveSpeed:=MV;
MoveAccel:=MA;
CanClose:=true;
end else begin
CanClose:=Hinweis1(HWindow,ST_BereichFehler,nil)=IDCancel;
end;
end;
end.
Detected encoding: ASCII (7 bit) | 2
|