home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0632.ZIP / CCE_0632 / GOBJ_111.ZIP / GOBJECTS.111 / SOURCE / BEISPIEL / BEISPL01.PAS < prev    next >
Pascal/Delphi Source File  |  1994-03-03  |  2KB  |  70 lines

  1. program Beispiel; {$X+} { Beispiel Nr.1 }
  2.  
  3. uses
  4.  
  5.     OTypes,OProcs,OWindows;
  6.  
  7. type
  8.  
  9.     TMyApplication = object(TApplication)
  10.         procedure InitMainWindow; virtual;
  11.     end;
  12.  
  13.     PBeispielWindow = ^TBeispielWindow;
  14.     TBeispielWindow = object(TWindow)
  15.         Veraendert: boolean;
  16.         constructor Init(AParent: PWindow; ATitle: string);
  17.         function CanClose: boolean; virtual;
  18.         procedure WMButton(mX,mY,BStat,KStat,Clicks: integer); virtual;
  19.     end;
  20.  
  21. var
  22.  
  23.     MyApp: TMyApplication;
  24.  
  25.  
  26. procedure TMyApplication.InitMainWindow;
  27.  
  28.     begin
  29.         new(PBeispielWindow,Init(nil,'ObjectGEM-Beispielprogramm'));
  30.         if (MainWindow=nil) or (ChkError<em_OK) then
  31.             Status:=em_InvalidMainWindow
  32.     end;
  33.  
  34.  
  35. constructor TBeispielWindow.Init(AParent: PWindow; ATitle: string);
  36.  
  37.     begin
  38.         if not(inherited Init(AParent,ATitle)) then fail;
  39.         Veraendert:=false
  40.     end;
  41.  
  42.  
  43. function TBeispielWindow.CanClose: boolean;
  44.     var valid: boolean;
  45.  
  46.     begin
  47.         valid:=inherited CanClose;
  48.         if valid and Veraendert then
  49.             valid:=(Application^.Alert(@self,1,WAIT,
  50.                 ' Die Grafik wurde verändert!| Wollen Sie sie speichern?',
  51.               '&Ja|  &Nein  ')=2);
  52.         CanClose:=valid
  53.     end;
  54.  
  55.  
  56. procedure TBeispielWindow.WMButton(mX,mY,BStat,KStat,Clicks: integer);
  57.  
  58.     begin
  59.         if bTst(BStat,1) then
  60.             Application^.Alert(@self,1,NOTE,'Sie haben links geklickt.','  &OK  ');
  61.         if bTst(BStat,2) then
  62.             Application^.Alert(@self,1,NOTE,'Sie haben rechts geklickt.','  &OK  ')
  63.     end;
  64.  
  65.  
  66. begin
  67.     MyApp.Init('BSPL','Beispiel');
  68.     MyApp.Run;
  69.     MyApp.Done
  70. end.