home *** CD-ROM | disk | FTP | other *** search
- Unit TWait;
-
- { TWait is a way to display a message while the computer is crunching }
- { numbers or processing data or whatever. First, invoke Wait with }
- { the message you want to display, then call CloseWait to get rid of }
- { the message window. It's really a simple approach to the problem, }
- { and some of you may not like the way I get rid of the window, but }
- { you can change it to suit your needs. Donated to the public domain }
- { but please let me know of any interesting changes to it! }
- (* Sample use:
- program TestWait;
- var PW: PWindow;
- { init TV and all the goodies }
- ...
- PW:=Wait('Please wait...Processing data');
- { do your number crunching here }
- CloseWait(PW);
- ... *)
- { as you can see, Wait will display a message window while your program }
- { is doing it's dirty deeds, and can then be closed when you are finished }
- { doing whatever you did. }
- { Send comments to Ty Brewer, CompuServe 72740,3230 }
-
-
- interface
- uses Views, Drivers, Objects, Dialogs, App;
-
- function Wait(AMessage: string): PWindow;
- procedure CloseWait(AWin: PWindow);
- implementation
-
- function Wait(AMessage: string): PWindow;
- var
- PW : PWindow;
- R : TRect;
- begin
- R.Assign(8, 2, 58, 8);
- PW:=New(PWindow, Init(R, 'Message', 99));
- PW^.Palette:=wpCyanWindow;
- PW^.State:=PW^.State and not(sfShadow);
- PW^.Options:=PW^.Options or (ofCentered) and not(ofSelectable);
- PW^.Flags:=PW^.Flags and not ((wfMove) or (wfGrow) or (wfZoom));
- R.Assign(1, 2, 49, 5);
- PW^.Insert(New(PStaticText, Init (R, ^C+AMessage)));
- DeskTop^.Insert(PW);
- Wait:=PW;
- end;
-
- procedure CloseWait(AWin: PWindow);
- begin
- message(AWin, evCommand, cmClose, nil);
- end;
-
- end.