home *** CD-ROM | disk | FTP | other *** search
- PROGRAM hello;
-
- USES Kernel, API, Dialogs;
-
- CONST ProjektName = 'hello'; { so heissen alle Dateien }
-
- VAR LaunchResult : integer;
- MyEvent : EventTyp; { eine Botschaft }
- StillRunning : boolean;
-
- procedure SayHello; { Die "Greeting Box" }
- var MyDialog: Dialog;
- MyButton: PButton;
- MyLabel : PLabelFrame;
- begin
- MyDialog.Init(330,120, MF_CAPTION, DefEventProc);
- MyDialog.SetCaption('Greeting Window');
- MyDialog.SetTopic('Hi there!');
-
- new(MyLabel, Init(20,15,290,95, 99, 'How are you?'));
- MyDialog.AddItem(MyLabel);
-
- new(MyButton, Init(30, 30, 120, 30, 1, 'Terrific'));
- MyDialog.AddItem(MyButton);
- MyButton^.MakeDefaultItem;
-
- new(MyButton, Init(30, 70,120, 30, 2, 'OK'));
- MyDialog.AddItem(MyButton);
- MyButton^.MakeDefaultItem;
-
- new(MyButton, Init(180, 30,120, 30, 3, 'Lousy'));
- MyDialog.AddItem(MyButton);
- MyButton^.MakeDefaultItem;
-
- new(MyButton, Init(180, 70, 120, 30, 4, 'Cancel'));
- MyDialog.AddItem(MyButton);
- MyButton^.MakeCancelItem;
-
- MyDialog.Show;
- MyDialog.DoDialog;
- MyDialog.Done;
- end;
-
-
- Procedure HandleMsg(MyMessage: EventTyp); far;
- { Hier werden die Botschaften behandelt. }
- Begin
- With MyMessage Do
- Case Class Of
- Menu : begin
- Case MenuItemID of
- 0 : StillRunning := false; { Ende }
- 101 : SayHello; { Begrüßung }
- end;
- end;
- end; { Case Class }
- End;
-
-
- Begin
- StillRunning := true;
- LaunchResult := OpenMainApplication(HandleMsg,
- APP_NOFONT,
- ProjektName);
-
- If LaunchResult = 0 then { erfolgreich gestartet }
- begin
- while StillRunning Do
- begin
- GetEvent(MyEvent);
- DispatchMessage(MyEvent);
- end;
- CloseMainApplication;
- end
- Else
- Writeln('Programm kann nicht gestartet werden. Fehler: ',LaunchResult);
- End.
-
-