home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / das_buch / tvision / demoapp / res1.pas next >
Encoding:
Pascal/Delphi Source File  |  1993-05-03  |  1.9 KB  |  81 lines

  1. (* ------------------------------------------------------ *)
  2. (*                      RES1.PAS                          *)
  3. (*       Demonstration der Verwendung von Ressourcen      *)
  4. (*             (c) 1993 te-wi Verlag, München             *)
  5. (* ------------------------------------------------------ *)
  6. PROGRAM Res1;
  7.  
  8. {$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,P-,Q+,R+,S+,T-,V+,X+,Y+}
  9. {$M 16384,0,655360}
  10.  
  11. USES Objects, Drivers, Views, Menus, App;
  12.  
  13. TYPE
  14.   tAnApp = OBJECT (tApplication)
  15.     CONSTRUCTOR Init;
  16.     PROCEDURE   InitMenuBar;    VIRTUAL;
  17.     PROCEDURE   InitStatusLine; VIRTUAL;
  18.     DESTRUCTOR  Done;           VIRTUAL;
  19.   END;
  20.  
  21. VAR
  22.   ResFile : tResourceFile;
  23.  
  24.   CONSTRUCTOR tAnApp.Init;
  25.   BEGIN
  26.     RegisterMenus;
  27.     RegisterObjects;
  28.     RegisterViews;
  29.     RegisterApp;
  30.     inherited Init;
  31.   END;
  32.  
  33.   PROCEDURE tAnApp.InitMenuBar;
  34.   VAR
  35.     R : tRect;
  36.   BEGIN
  37.     GetExtent(R);
  38.     R.B.Y := R.A.Y + 1;
  39.     MenuBar := New(PMenuBar, Init(R, NewMenu(
  40.       NewSubMenu('~D~atei', hcNoContext, NewMenu(
  41.         StdFileMenuItems(nil)),
  42.       nil))));
  43.   END;
  44.  
  45.   PROCEDURE tAnApp.InitStatusLine;
  46.   VAR
  47.     R : tRect;
  48.   BEGIN
  49.     GetExtent(R);
  50.     R.A.Y := R.B.Y - 1;
  51.     StatusLine := New(pStatusLine, Init(R,
  52.       NewStatusDef(0, $FFFF,
  53.         NewStatusKey('~F3~ Öffnen', kbF3, cmOpen,
  54.         NewStatusKey('~F2~ Speichern', kbF3, cmSave,
  55.         NewStatusKey('~Alt+X~ Beenden', kbAltX, cmQuit,
  56.       NIL))),
  57.     NIL)));
  58.   END;
  59.  
  60.   DESTRUCTOR tAnApp.Done;
  61.   BEGIN
  62.     ResFile.Init(New(pBufStream, Init('RES1.RES', stCreate, 1024)));
  63.     ResFile.Put(MenuBar, 'APPMENU');
  64.     ResFile.Put(StatusLine, 'STATLINE');
  65.     ResFile.Done;
  66.     inherited Done;
  67.   END;
  68.  
  69. VAR
  70.   AnApp : tAnApp;
  71.  
  72. BEGIN
  73.   AnApp.Init;
  74.   AnApp.Run;
  75.   AnApp.Done;
  76. END.
  77. (* ------------------------------------------------------ *)
  78. (*                 Ende von RES1.PAS                      *)
  79.  
  80.  
  81.