home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / tpw / owldemos / editapp.pas < prev    next >
Pascal/Delphi Source File  |  1991-05-20  |  2KB  |  58 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Pascal for Windows                     }
  4. {   Demo program                                 }
  5. {   Copyright (c) 1991 by Borland International  }
  6. {                                                }
  7. {************************************************}
  8.  
  9. program TextEditor;
  10.  
  11. uses WObjects, WinTypes, WinProcs, StdWnds;
  12.  
  13. type
  14.  
  15.   { Declare TEditApp, a TApplication descendant }
  16.   TEditApp = object(TApplication)
  17.     procedure InitMainWindow; virtual;
  18.     procedure InitInstance; virtual;
  19.   end;
  20.  
  21.   { Declare TMyEditWindow, a TEditWindow descendant }
  22.   PMyEditWindow = ^TMyEditWindow;
  23.   TMyEditWindow = object(TEditWindow)
  24.     constructor Init(AParent: PWindowsObject; ATitle: PChar);
  25.   end;
  26.  
  27. { Construct a TMyEditWindow, loading its menu }
  28. constructor TMyEditWindow.Init(AParent: PWindowsObject; ATitle: PChar);
  29. begin
  30.   TEditWindow.Init(AParent, ATitle);
  31.   Attr.Menu := LoadMenu(HInstance, 'EditCommands');
  32. end;
  33.  
  34. { Construct the TEditApp's MainWindow of type TMyEditWindow }
  35. procedure TEditApp.InitMainWindow;
  36. begin
  37.   MainWindow := New(PMyEditWindow, Init(nil, 'EditWindow'));
  38. end; 
  39.  
  40. { Initialize each MS-Windows application instance, loading an
  41.   accelerator table }
  42. procedure TEditApp.InitInstance;
  43. begin
  44.   TApplication.InitInstance;
  45.   HAccTable := LoadAccelerators(HInstance, 'EditCommands');
  46. end;
  47.  
  48. { Declare a variable of type TEditApp } 
  49. var
  50.   EditApp : TEditApp;
  51.  
  52. { Run the EditApp }
  53. begin
  54.   EditApp.Init('EditApp');
  55.   EditApp.Run;
  56.   EditApp.Done;
  57. end.
  58.