Silverfrost Logo About Us | Contact Us

Leave window open - %lw[option]

By default, winio@ does not return until the window that it creates is closed. Occasionally it is useful to create a window that remains open while the program takes other actions. %lw causes winio@ to return as soon as it has created the window (the return value of winio@ is not used in this case). The format takes one INTEGER argument that can be used to close the window. This integer, known as the control variable, is set to -1 while the window is still active. It is very important that the control variable used to receive the result does not cease to exist before the window closes. Hence it is necessary to use a variable that is either global (appears in the main program, a COMMON block or MODULE) or static (appears in a SAVE or DATA statement).

Note: Although the control variable is initialised by the call to winio@, you may choose to give it a value before the call in order to avoid a compiler warning.

%lw is also used to create a child window that is to be inserted within another window that includes %ch. The grave accent is used in this context. In this case the window is not displayed until the control variable is passed to the window containing %ch. See %ch below for an example of this procedure. A child window may be used only once. If it is not used it will be destroyed when the program terminates.

A window that has been left open by means of %lw can be closed by setting its control variable to a non-negative value and by passing the address of the control variable to window_update@.

For example:

  INTEGER control
  i=winio@('Processing - please wait%lw',control)
  CALL do_something_complex()
  CALL window_update@(control)

It is possible to use %lw in conjunction with graphics drawing using %gr, %og or %dw. This provides a means of drawing to a region after it has been created. However, it is recommended that code to draw to a graphics region be placed in a call-back function attached to %sc.

%lw can take the option owned ( %lw[owned] ). This option defines certain properties of the window in relation to its parent. The "owned" properties are those of a window that does not use %lw, namely that the parent cannot overlay the child and, if the parent is closed, the child automatically closes. For these properties to be meaningful the parent must be created using %ww. Also %lw[owned] must be used in the definition of a child window that appears in a call-back function of the parent.



Copyright © 1999-2017 Silverfrost Limited