unit Motorsel;
{Motor-Auswahl-Dialog}
interface
uses WinProcs,WinTypes,OWindows,ODialogs,Strings,
smsh,smsp,mpk3d;
const
ID_CBSel=101;
ID_Dreieck=102;
ID_Hilfe=3;
type
PMotorSelDlg=^TMotorSelDlg;
TMotorSelDlg=object(TDialog)
Sel:PComboBox;
constructor Init(AParent: PWindowsObject; AName: PChar);
procedure SetupWindow; virtual;
procedure IDHilfe(var Msg:TMessage); virtual ID_First+ID_Hilfe;
function CanClose:Boolean; virtual;
destructor Done; virtual;
end;
implementation
constructor TMotorSelDlg.Init(AParent: PWindowsObject; AName: PChar);
begin
inherited Init(AParent,AName);
Sel:=New(PComboBox,InitResource(@self,ID_CBSel,80));
end;
destructor TMotorSelDlg.Done;
begin
Dispose(Sel,Done);
inherited Done;
end;
procedure TMotorSelDlg.SetupWindow;
var
S:TS255;
SP:PChar;
begin
inherited SetupWindow;
LoadString(HInstance,ST_MotorSel,S,sizeof(S));
SP:=S;
while SP^<>#0 do begin {Schleife bis zur abschließenden Doppel-Null}
Sel^.AddString(SP);
SP:=StrEnd(SP)+1;
end;
Sel^.SetSelIndex(UnitUsed);
CheckDlgButton(HWindow,ID_Dreieck,Word(UseDreieck));
end;
procedure TMotorSelDlg.IDHilfe(var Msg:TMessage);
begin
WinHelp(HWindow,HelpFileName,HELP_Context,ID_Connect);
end;
function TMotorSelDlg.CanClose:Boolean;
var
NewUnit:Integer;
Answer:Integer;
begin
UseDreieck:=IsDlgButtonChecked(HWindow,ID_Dreieck)=1;
NewUnit:=Sel^.GetSelIndex;
if SendMessage(Parent^.HWindow,WM_Assign,Word(NewUnit),0)<>0 then begin
CanClose:=true;
end else begin
Answer:=HinweisFrage(HWindow,ST_NoMotor,NewUnit,
MB_AbortRetryIgnore or MB_IconExclamation);
case Answer of
IDAbort: CanClose:=true; {Nur Dialog schließen wie "Abbrechen"}
IDRetry: ; {Nichts tun, Dialog bleibt}
IDIgnore: begin {Motor gewaltsam freigeben}
VxDsupC(SM_Stop,NewUnit,0,0);
VxDsupC(SM_UnAssign,NewUnit,0,0);
if SendMessage(Parent^.HWindow,WM_Assign,Word(NewUnit),0)<>0 then begin
CanClose:=true;
end;
end;
end{case};
end;
end;
end.
Detected encoding: OEM (CP437) | 1
|
|