home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmos2002.zip / SRC / maintena.mod < prev    next >
Text File  |  1997-11-10  |  3KB  |  90 lines

  1. IMPLEMENTATION MODULE MaintenancePages;
  2.  
  3.         (********************************************************)
  4.         (*                                                      *)
  5.         (*      Support for "maintenance page" screen output    *)
  6.         (*                                                      *)
  7.         (*  Programmer:         P. Moylan                       *)
  8.         (*  Last edited:        10 November 1997                *)
  9.         (*  Status:             Working                         *)
  10.         (*                                                      *)
  11.         (********************************************************)
  12.  
  13. FROM MultiScreen IMPORT
  14.     (* type *)  ScreenGroup, VirtualScreen,
  15.     (* proc *)  EnableHotKeys, CreateScreenGroup, CreateVirtualScreen,
  16.                 RemoveVirtualScreen, MapToVirtualScreen;
  17.  
  18. FROM Windows IMPORT
  19.     (* type *)  Window, Colour, FrameType, DividerType,
  20.     (* proc *)  OpenWindowHidden, WriteString, PutOnPage, PutOnTop, SetCursor;
  21.  
  22. (************************************************************************)
  23.  
  24. TYPE MaintenancePage = VirtualScreen;
  25.  
  26. VAR
  27.     (* All maintenance pages are collected together as a single group.  *)
  28.  
  29.     MPGroup: ScreenGroup;
  30.  
  31.     (* The prompt window appears on every maintenance page.     *)
  32.  
  33.     prompt: Window;
  34.  
  35. (************************************************************************)
  36. (*                      EXTERNALLY CALLABLE PROCEDURES                  *)
  37. (************************************************************************)
  38.  
  39. PROCEDURE CreateMaintenancePage (VAR (*OUT*) page: MaintenancePage);
  40.  
  41.     (* Creates a new maintenance page.  *)
  42.  
  43.     BEGIN
  44.         page := CreateVirtualScreen (MPGroup);
  45.     END CreateMaintenancePage;
  46.  
  47. (************************************************************************)
  48.  
  49. PROCEDURE RemoveMaintenancePage (VAR (*INOUT*) page: MaintenancePage);
  50.  
  51.     (* Destroys all associations between the given page and its screen  *)
  52.     (* windows (but does not close the windows), and permanently        *)
  53.     (* removes this page from the collection of maintenance pages.      *)
  54.  
  55.     BEGIN
  56.         RemoveVirtualScreen (page);
  57.     END RemoveMaintenancePage;
  58.  
  59. (************************************************************************)
  60.  
  61. PROCEDURE Associate (w: Window;  page: MaintenancePage);
  62.  
  63.     (* Before calling this procedure, both w and page must have been    *)
  64.     (* created.  This procedure ensures that window w is visible on     *)
  65.     (* the screen only when the given maintenance page is active.       *)
  66.  
  67.     BEGIN
  68.         MapToVirtualScreen (w, page);
  69.     END Associate;
  70.  
  71. (************************************************************************)
  72. (*                         MODULE INITIALISATION                        *)
  73. (************************************************************************)
  74.  
  75. CONST
  76.     AltP = CHR(25);   (* second code returned by Alt/P key         *)
  77.     F6 = '@';         (* second code returned by F6 function key   *)
  78.  
  79. BEGIN
  80.     MPGroup := CreateScreenGroup (1);
  81.     EnableHotKeys (TRUE, AltP, TRUE, F6);
  82.     OpenWindowHidden (prompt, blue, cyan, 24, 24, 0, 79, noframe, nodivider);
  83.     PutOnPage (prompt, 1);
  84.     WriteString (prompt, "  F6 cycle");
  85.     SetCursor (prompt, 0, 48);
  86.     WriteString (prompt, "Alt/P maintenance pages on/off");
  87.     PutOnTop (prompt);
  88. END MaintenancePages.
  89.  
  90.