Kbase P65388: 4GL How to parameterize the suppress-window option?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/02/2004 |
|
Status: Unverified
GOAL:
How to parameterize the suppress-window option?
FACT(s) (Environment):
Progress 9
FIX:
As documented, the point of the Suppress-window option is to convert the window to "frame-only." When run, the frame(s) appear in the CURRENT-WINDOW. (The AppBuilder comments out the CREATE WINDOW statement when this option is checked)
Solution to parameterize this option is to not check it and delete the window at run time when we want to suppress the window, by doing something like the following at the beginning of the main block:
/* *************************** Main Block *************************** */
/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames. */
IF cSuppressW <> "suppressWindow" THEN ASSIGN
CURRENT-WINDOW = {&WINDOW-NAME}
THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
ELSE DO:
DELETE WIDGET {&WINDOW-NAME}.
{&WINDOW-NAME} = CURRENT-WINDOW.
END.
/* The CLOSE event can be used from inside or outside the procedure to */
/* terminate it. */
ON CLOSE OF THIS-PROCEDURE
RUN disable_UI.
This code relies on cSuppressWan defined as an INPUT PARAM AS CHAR (in the definition block). To avoid the definition of such an additional parameter, you may use the following code befre the code above:
cSuppressW = DYNAMICS-FUNCTION("getSuppressW", IN SOURCE-PROCEDURE) NO-ERROR.
and have a getSuppressW function defined in the calling procedure (the one that runs the .w file) to return "suppressWindows" or "YesKeepYourWindowPlease" (or whatever). Note that with the code above, if the function is not implemented in the calling procedure, then no error will occur thanks to the NO-ERROR option, resulting in a window not of type "SuppressWindow".
At last, to avoid a flashing effect because of the creation of a dummy window, you shall check the HIDDEN propery of the window in its property sheet, and set it back to FALSE by program in the main block. Note that if any widget is enabled by enable_UI, then the window will automatically be made visible.