home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* CALCDEMO.PAS *)
- (* Demonstration des HexCalc-Objekts *)
- (* (c) 1993 te-wi Verlag, München *)
- (* ------------------------------------------------------ *)
- PROGRAM CalcDemo;
-
- {$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,P-,Q+,R+,S+,T-,V+,X+,Y+}
- {$M 16384,0,655360}
-
- USES Objects, Drivers, Views, Menus, MsgBox, Dialogs, App,
- HexCalc;
-
- CONST
- cmAbout = 100;
-
- PROCEDURE DoCalc;
- VAR
- C : pPetzCalc;
- BEGIN
- C := New(pPetzCalc, Init);
- Desktop^.Insert(C);
- END;
-
- TYPE
- tMyApp = OBJECT (tApplication)
- PROCEDURE InitMenuBar; VIRTUAL;
- PROCEDURE HandleEvent(VAR Event : tEvent); VIRTUAL;
- END;
-
- PROCEDURE tMyApp.InitMenuBar;
- VAR
- R : tRect;
- BEGIN
- GetExtent(R);
- R.B.Y := R.A.Y + 1;
- MenuBar := New(pMenuBar, Init(R, NewMenu(
- NewSubMenu('~≡~', hcNoContext, NewMenu(
- NewItem('~C~alc', '', kbNoKey, cmCalc, hcNoContext,
- NewItem('~A~bout', '', kbNoKey, cmAbout, hcNoContext,
- NIL))),
- NIL))));
- END;
-
- PROCEDURE tMyApp.HandleEvent(VAR Event : tEvent);
- BEGIN
- inherited HandleEvent(Event);
-
- IF Event.What = evCommand THEN BEGIN
- CASE Event.Command OF
- cmCalc : BEGIN
- DoCalc;
- END;
- cmAbout : BEGIN
- MessageBox(#3'HexCalc Demo Application',
- NIL, mfInformation OR mfOkButton);
- END;
- ELSE
- Exit;
- END;
- ClearEvent(Event);
- END;
- END;
-
- VAR
- anApp : tMyApp;
-
- BEGIN
- anApp.Init;
- anApp.Run;
- anApp.Done;
- END.
- (* ------------------------------------------------------ *)
- (* Ende von CALCDEMO.PAS *)
-