•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileOPENW n[,x_pos,y_pos]
OPENW #n,x,y,w,h,attr
CLOSEW [#]n

n, x, y, w, h, attr, x_pos, y_pos: aexp

With 'OPENW n' window number n is opened. The parameters x_pos and y_pos
determine the position of the 'free' window corner, i.e. the one which is not
on the edge of the screen. The AES routines, 'OPENW #n' or WINDTAB() are
required for more flexible window management. The coordinates of the possible
windows set up with this instruction (assuming high-resolution mode) will be:

    Number  Top left corner  Lower right corner
    1       0,19             x_pos,y_pos
    2       x_pos,19         639,y_pos
    3       0,y_pos          x_pos,399
    4       x_pos,y_pos      639,399

Arranged as follows:

          0            x_pos           639
     19    -----------------------------
          |              |              |
          |      1       |      2       |
          |              |              |
    y_pos |--------------|--------------|
          |              |              |
          |      3       |      4       |
          |              |              |
    399    -----------------------------

The point (x_pos,y_pos) is thus the point of contact of the four possible
windows.

With the instruction 'OPENW 0' no genuine window is opened, but the coordinate
origin is moved to (0,19). Thus the upper 19 lines of the screen are protected
from graphical or text output. This usually protects a menu bar against
accidental overwriting.

The instruction 'CLOSEW n' closes the window with number n, 'CLOSEW #n'
closes the window with the arbitrarily assigned number n. (See also example
program at the end of this section.)

Example:

    REPEAT
      IF MOUSEK=1
        CLOSEW 1
        OPENW 4,320,200
      ENDIF
      IF MOUSEK=2
        CLOSEW 4
        OPENW 1,100,100
      ENDIF
    UNTIL MOUSEK=3
    CLOSEW #1
    CLOSEW #4

--> Pressing the left mouse button opens window 4 and closes window 1, or
    pressing the right mouse button opens window 1 and closes window 4.
    Simultaneously pressing both mouse buttons terminates the program.

The second variant, 'OPENW #n', opens a window with the arbitrarily assigned
number 'n', with the position, size, and attributes specified in x, y, w, h,
and attr. The expression attr determines which window components (title bar,
sliders, etc.) the window is to have (see WINDTAB() below or WIND_CREATE() in
the AES section). 'n' is then the number to be used with TITLEW, INFOW, etc. -
it is NOT the GEM 'handle' of the window.

'CLOSEW #n' closes such a window.

Example:

    TITLEW #1," Title 1 "                 !Gives title to window #1
    INFOW #1,STRING$(15,"...| ")          !Allocates info line
    OPENW #1,16,32,600,300,&X111111111111 !Sets coords + attributes and opens a window
    ~INP(2)
    CLOSEW #1                             !Important! Closes window

--> Opens a window with a title and an info line. Pressing a key terminates the
    program.

Memo: None of these commands properly check the window number.
      This is true for the editor and the library.

      'OPENW n,x,y' will ignore the command if the x or y are off screen.

      'OPENW #n,x,y,w,h,a' will accept index 0 then ignore the rest of the
      parameters. This appears to be a bug.

      CLOSEW 0 will restore _X and _Y back to the screen width and height.

wind_create()+, wind_open()+, wind_close()+, wind_delete()+