home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 20 / ln1120 / test4.pas < prev    next >
Pascal/Delphi Source File  |  1992-08-02  |  1KB  |  48 lines

  1. {
  2. Title: TEST4.PAS
  3. Caption: A small OWL program to show off the BWCC-like customized font dialog.
  4. }
  5.  
  6. program Test4;
  7.  
  8. uses winprocs, wintypes, wobjects, commdlg, UTest4, strings;
  9.  
  10. {$R Test4}
  11.  
  12. type
  13.  
  14.   TMyApp = object(TApplication)
  15.     procedure InitMainWindow; virtual;
  16.   end;
  17.  
  18.   PMyMainWindow = ^TMyMainWindow;
  19.   TMyMainWindow = object(TMDIWindow)
  20.     procedure cmChooseFont(var Msg: TMessage); virtual cm_First + 101;
  21.   end;
  22.  
  23. procedure TMyMainWindow.cmChooseFont(var Msg: TMessage);
  24. var
  25.   LF: TLogFont;
  26.   Result: Integer;
  27. begin
  28.   FillChar(LF, Sizeof(LF), 0);
  29.   Result := Application^.ExecDialog(New(PChooseFontDlg,
  30.               Init(@Self, 0, @LF)));
  31.   if Result = idOk then                     
  32.     MessageBox(HWindow, LF.lfFaceName, 'You selected', mb_OK);
  33. end;
  34.  
  35. procedure TMyApp.InitMainWindow;
  36. begin
  37.   MainWindow := new(PMyMainWindow, Init('Test CommDlg',
  38.                      LoadMenu(HInstance, 'MainMenu')));
  39. end;
  40.  
  41. var MyApp: TMyApp;
  42. begin
  43.   MyApp.Init('TestCommDlg');
  44.   MyApp.Run;
  45.   MyApp.Done;
  46. end.
  47.  
  48.