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 / BEISPL02.PAS < prev    next >
Pascal/Delphi Source File  |  1994-03-03  |  2KB  |  78 lines

  1. program Beispiel; {$X+} { Beispiel Nr.2 }
  2.  
  3. uses
  4.  
  5.     Gem,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.             if GetDC>=0 then
  61.                 begin
  62.                     v_gtext(vdiHandle,mX,mY,'('+ltoa(mX)+','+ltoa(mY)+')');
  63.                     ReleaseDC;
  64.                     Veraendert:=true
  65.                 end;
  66.         if bTst(BStat,2) then
  67.             begin
  68.                 ForceRedraw;
  69.                 Veraendert:=false
  70.             end
  71.     end;
  72.  
  73.  
  74. begin
  75.     MyApp.Init('BSPL','Beispiel');
  76.     MyApp.Run;
  77.     MyApp.Done
  78. end.