home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l040 / 11.ddi / OWLDEMOS.ZIP / EDITAPP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-10-27  |  1.5 KB  |  57 lines

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