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

  1. {************************************************}
  2. {                                                }
  3. {   ObjectWindows Demo                           }
  4. {   Copyright (c) 1992 by Borland International  }
  5. {                                                }
  6. {************************************************}
  7.  
  8. program EWndTest;
  9.  
  10. {$R EWNDTEST.RES}
  11.  
  12. uses WinTypes, WinProcs, Strings, OWindows, OStdWnds;
  13.          
  14. const
  15.   cm_SendText = 399;
  16.  
  17. type
  18.   TTestApplication = object(TApplication)
  19.     procedure InitMainWindow; virtual;
  20.   end;
  21.  
  22.   PTestWindow = ^TTestWindow;
  23.   TTestWindow = object(TEditWindow)
  24.     constructor Init(AParent: PWindowsObject; ATitle: PChar);
  25.     procedure HandleSend(var Msg: TMessage);
  26.       virtual cm_First + cm_SendText;
  27.   end;
  28.  
  29. { --------TTestWindow methods------------------ }
  30. constructor TTestWindow.Init(AParent: PWindowsObject; ATitle: PChar);
  31. begin
  32.   inherited Init(AParent, ATitle);
  33.   Attr.Menu := LoadMenu(HInstance, MakeIntResource(102));
  34. end;
  35.  
  36. procedure TTestWindow.HandleSend(var Msg: TMessage);
  37. var
  38.   Lines: Integer;
  39.   Text: array[0..20] of Char;
  40. begin
  41.   Lines := Editor^.GetNumLines;
  42.   Str(Lines, Text);
  43.   StrCat(Text, ' lines sent');
  44.   MessageBox(HWindow, @Text, 'Message Sent', mb_Ok);
  45. end;
  46.  
  47. { -----------TTestApplication Methods------------ }
  48. procedure TTestApplication.InitMainWindow;
  49. begin
  50.   MainWindow := New(PTestWindow, Init(nil, 'Edit Window Tester'));
  51.   HAccTable := LoadAccelerators(HInstance, MakeIntResource(100));
  52. end;
  53.  
  54. var
  55.   TestApp : TTestApplication;
  56.  
  57. begin
  58.   TestApp.Init('EWndTest');
  59.   TestApp.Run;
  60.   TestApp.Done;
  61. end.
  62.  
  63.