home *** CD-ROM | disk | FTP | other *** search
- (***************************************
- * WG-VISION 1.0 BEISPIELPROGRAMM *
- ****************************************
- * *
- * Erzeugung einer beliebigen Anzahl *
- * von zufällig verteilten Fenstern *
- * *
- ****************************************
- * (c) 1993 Dipl.Phys. Mathias Scholz *
- ***************************************)
-
- {$I COMPILER.INC}
-
- program ZFenst;
-
- uses WApp,
- WDecl,
- WEvent,
- WViews,
- WDlg,
- 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 {WinList von hinten nach vorn abbauen}
- begin
- LfdPtr:=WinList^.GetItems(I); {Pointer holen über Index}
- LfdPtr^.Hide; {Fenster schließen, Untergrund restaurieren}
- WinList^.DelLastItem; {Pointer aus der Liste entfernen und}
- end; {Speicherplatz freigeben}
- WinCount:=0; WinAnz:=0; {Das wars !}
- end;
- end;
-
- {Hauptprogramm}
-
- begin
- MyProg.Init('Zufallsfenster');
- MyProg.Run;
- MyProg.Done;
- end.
-
-