home *** CD-ROM | disk | FTP | other *** search
- Uses Graph, Crt, XV2App;
-
- Type
- PButton=^TButton;
- TButton=Object(TView)
- Procedure Draw; Virtual;
- Procedure HandleEvent(var Event: TEvent); Virtual;
- End;
-
- PWindow=^TWindow;
- TWindow=Object(TView)
- color: Byte;
- Constructor Init(ax,ay,aw,ah: Integer);
- Procedure Draw; Virtual;
- End;
-
- Procedure TButton.HandleEvent;
- Begin
- Case Event.What of
- EvMouseDown: Begin;Sound(800);delay(100);nosound;End;
- EvMouseUp : Begin;Sound(1200);delay(100);nosound;End;
- End;
- End;
-
- Procedure TButton.Draw;
- Begin
- SetFillStyle(1,1);
- Bar(0,0,w,h);
- SetColor(15);
- Rectangle(0,0,w,h);
- End;
-
- Constructor TWindow.Init;
- Begin
- Inherited Init(ax,ay,aw,ah);
- Color:=random(15);
- Insert(New(PButton, Init(1,1,12,12)));
- Insert(New(PButton, Init(20,30,50,20)));
- Insert(New(PButton, Init(30,40,50,20)));
- Insert(New(PButton, Init(30,70,50,20)));
- End;
-
- Procedure TWindow.Draw;
- Begin
- Sound(300);delay(100);nosound;
- SetFillStyle(1,1);
- Bar(0,0,w,15);
- SetFillStyle(1,color);
- Bar(0,16,w,h);
- SetColor(0);
- Rectangle(0,0,w,h);
- Line(0,15,w,15);
- End;
-
- Var
- MyApp: TApplication;
-
- Begin
- Randomize;
- MyApp.Init;
- MyApp.Insert(New(PWindow, Init(10,10,300,100)));
- MyApp.Insert(New(PWindow, Init(30,30,350,150)));
- MyApp.Insert(New(PWindow, Init(50,50,400,200)));
- MyApp.Run;
- End.