home *** CD-ROM | disk | FTP | other *** search
- program Beispiel12;
-
- uses GDecl,
- GApp,
- GEvent,
- GViews,
- GDlg,
- Graph;
-
-
- const cmStandard = 101;
- cmCloseAllWindows = 102;
-
- type TApplication=object(TApp)
- procedure InitMenuBar; virtual;
- procedure HandleEvent; virtual;
- procedure NewWindow;
- procedure CloseAllWindows;
- end;
-
- var MyProg:TApplication;
-
- {Implementation TApplication}
-
- procedure TApplication.InitMenuBar;
- begin
- MainMenu('~F~enster',0);
- SubMenu('~Z~ufalls-Fenster F8',cmStandard,0,kbF8,false,false);
- SubMenu('~F~enster schließen',cmCloseAllWindows,0,0,false,false);
- SubMenu('E~x~it Alt-X',cmCloseApplication,0,altX,false,false);
- end;
-
- procedure TApplication.HandleEvent;
- begin
- Heap^.ShowHeapStatus(523,8,White);
- TProgram.HandleEvent;
- case Event.Command of
- cmStandard : NewWindow;
- cmCloseAllWindows : CloseAllWindows;
- end; {case}
- end;
-
-
- procedure TApplication.NewWindow;
- var R:TRect;
- x,y:integer;
- Window:PWindow;
- begin
- x:=Random(480)+4;
- y:=Random(328)+48;
- R.Assign(x,y,x+150,y+100);
- Window:=new(PWindow, Init(R,'ZufallsFenster',winDouble+winPanel+winMenu+winKey));
- InsertDesktop(Window);
- end;
-
- procedure TApplication.CloseAllWindows;
- var i:integer;
- LfdPtr:PGroup;
- begin
- with Desktop^ do
- begin
- for i:=WinCount downto 1 do
- begin
- LfdPtr:=WinList^.GetItems(i);
- LfdPtr^.Hide;
- WinList^.DelLastItem;
- end;
- WinCount:=0; WinAnz:=0;
- end;
- end;
-
- {Hauptprogramm}
-
- begin
- MyProg.Init('Beispiel 12');
- MyProg.Run;
- MyProg.Done;
- end.