When a window is made
, it receives graphics output (from
, for example) but is not brought to the foreground and thus does not have the
. When a window acquires focus, either by a mouse click, I/O to it, or by a
call, it also becomes the
window. When a window gains focus, the window that previously had focus will lose focus.
If a window needs to be brought to the foreground, it must be given
. The window that has the focus is always on top, and all other windows have their title bars grayed out. A window can have the focus and yet not be active and not have graphics output directed to it. Graphical output is independent of focus.
Under most circumstances,
should apply to the same window. This is the default behavior of QuickWin and a programmer must consciously override this default.
Certain QuickWin routines (such as
) that do not take a unit number as an input argument usually affect the
window whether or not it is in
If another window is made
but is not in
, these routines affect the window
at the time of the routine call. This may appear unusual to the user since a
under these circumstances will expect input from a grayed, background window. The user would then have to click on that window before input could be typed to it.
To use these routines (that effect the
window), either do I/O to the unit number of the window you wish to put in
(and also make
), or call FOCUSQQ (with a unit number specified). If only one window is open, then that window is the one affected. If several windows are opened, then the last one opened is the one affected since that window will get
as a side effect of being opened.
(IOFOCUS) parameter also can determine whether a window receives the focus when a I/O statement is executed on that unit. For example:
OPEN (UNIT = 10, FILE = 'USER', IOFOCUS = .TRUE.)
With an explicit
with FILE='USER', IOFOCUS defaults to .TRUE. For child windows opened implicitly (no
statement before the
, or PRINT) as unit 0, 5, or 6, IOFOCUS defaults to .FALSE..
If IOFOCUS=.TRUE., the child window receives focus prior to each
. Calls to
or graphics functions (for example,
) do not cause the focus to shift. If you use IOFOCUS with any unit other than a QuickWin child window, a run-time error occurs.
The focus shifts to a window when it is given the focus with
, when it is selected by a mouse click, or when an I/O operation other than a graphics operation is performed on it, unless the window was opened with IOFOCUS=.FALSE..
determines which unit has the focus. For example:
INTEGER status, focusunit
OPEN(UNIT = 10, FILE = 'USER', TITLE = 'Child Window 1')
OPEN(UNIT = 11, FILE = 'USER', TITLE = 'Child Window 2')
! Give focus to Child Window 2 by writing to it:
WRITE (11, *) 'Giving focus to Child 2.'
! Give focus to Child Window 1 with the FOCUSQQ function:
status = FOCUSQQ(10)
! Find out the unit number of the child window that currently has focus:
status = INQFOCUSQQ(focusunit)
makes a child window active without bringing it to the foreground.
returns the unit number of the currently active child window.
converts the unit number into a Windows handle for functions that require it.