# SETWINDOWCONFIG (W*S)

QuickWin Function: Sets the properties of a child window.

## Module

USE IFQWIN

result = SETWINDOWCONFIG (wc)

wc | (Input) Derived type `windowconfig`. Contains window properties. The `windowconfig` derived type is defined in `IFQWIN.F90` as follows:
    TYPE windowconfig
      INTEGER(2) numxpixels         ! Number of pixels on x-axis.
      INTEGER(2) numypixels         ! Number of pixels on y-axis.
      INTEGER(2) numtextcols        ! Number of text columns available.
      INTEGER(2) numtextrows        ! Number of text rows available.
      INTEGER(2) numcolors          ! Number of color indexes.
      INTEGER(4) fontsize           ! Size of default font. Set to
                                    !   QWIN$EXTENDFONT when specifying
                                    !   extended attributes, in which
                                    !   case extendfontsize sets the
                                    !   font size.
      CHARACTER(80) title               ! The window title.
      INTEGER(2) bitsperpixel       ! The number of bits per pixel.
      INTEGER(2) numvideopages          ! Unused.
      INTEGER(2) mode               ! Controls scrolling mode.
      INTEGER(2) adapter                ! Unused.
      INTEGER(2) monitor                ! Unused.
      INTEGER(2) memory                 ! Unused.
      INTEGER(2) environment            ! Unused.
    ! The next three parameters provide extended font
    ! attributes.
      CHARACTER(32) extendfontname      ! The name of the desired font.
      INTEGER(4) extendfontsize     ! Takes the same values as fontsize,
                                    ! when fontsize is set to
                                    ! QWIN$EXTENDFONT.
      INTEGER(4) extendfontattributes   ! Font attributes such as bold
                                        ! and italic.
    END TYPE windowconfig

## Results

The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..

The following value can be used to configure a QuickWin window so that it will show the last line written and the text cursor (if it is on):

      wc%mode = QWIN$SCROLLDOWN

Note that if you scroll the window to another position, you will have to scroll back to the last line to see your input.

The following values can be used with SETWINDOWCONFIG extended fonts:

Style:
QWIN$EXTENDFONT_NORMAL | No underline, no italic, and a font weight of 400 out of 1000.
QWIN$EXTENDFONT_UNDERLINE | Underlined characters.
QWIN$EXTENDFONT_BOLD | A font weight of 700 out of 1000.
QWIN$EXTENDFONT_ITALIC | Italic characters.

Pitch:
QWIN$EXTENDFONT_FIXED_PITCH | QuickWin default. Equal character widths.
QWIN$EXTENDFONT_VARIABLE_PITCH | Variable character widths.

Font Families:
QWIN$EXTENDFONT_FF_ROMAN | Variable stroke width, serifed. Times Roman, Century Schoolbook, etc.
QWIN$EXTENDFONT_FF_SWISS | Variable stroke width, sans-serifed. Helvetica, Swiss, etc.
QWIN$EXTENDFONT_FF_MODERN | QuickWin default. Constant stroke width, serifed or sans-serifed. Pica, Elite, Courier, etc.
QWIN$EXTENDFONT_FF_SCRIPT | Cursive, etc.
QWIN$EXTENDFONT_FF_DECORATIVE | Old English, etc.

Character Sets:
QWIN$EXTENDFONT_ANSI_CHARSET | QuickWin default.
QWIN$EXTENDFONT_OEM_CHARSET | Use this to get Microsoft* LineDraw.

Using QWIN$EXTENDFONT_OEM_CHARSET with the font name 'MS LineDraw'C will get the old DOS-style character set with symbols that can be used to draw lines and boxes. The pitch and font family items can be specified to help guide the font matching algorithms used by CreateFontIndirect, the Windows* API used by SETWINDOWCONFIG.

If you use SETWINDOWCONFIG to set the variables in `windowconfig` to -1, the function sets the highest resolution possible for your system, given the other fields you specify, if any. You can set the actual size of the window by specifying parameters that influence the window size: the number of x and y pixels, the number of rows and columns, and the font size. If you do not call SETWINDOWCONFIG, the window defaults to the best possible resolution and a font size of 8x16. The number of colors available depends on the video driver used.

If you use SETWINDOWCONFIG, you should specify a value for each field (-1 or your own value for the numeric fields and a C string for the title, for example, "words of text"C). Using SETWINDOWCONFIG with only some fields specified can result in useless values for the unspecified fields.

If you request a configuration that cannot be set, SETWINDOWCONFIG returns .FALSE. and calculates parameter values that will work and are as close as possible to the requested configuration. A second call to SETWINDOWCONFIG establishes the adjusted values; for example:

    status = SETWINDOWCONFIG(wc)
    if (.NOT.status) status = SETWINDOWCONFIG(wc)

If you specify values for all four of the size parameters, numxpixels, numypixel, numtextcols, and numtextrows, the font size is calculated by dividing these values.The default font is Courier New and the default font size is 8x16. There is no restriction on font size, except that the window must be large enough to hold it.

Under Standard Graphics, the application attempts to start in Full Screen mode with no window decoration (window decoration includes scroll bars, menu bar, title bar, and message bar) so that the maximum resolution can be fully used. Otherwise, the application starts in a window. You can use ALT+ENTER at any time to toggle between the two modes.

If you are in Full Screen mode and the resolution of the window does not match the resolution of the video driver, graphics output will be slow compared to drawing in a window.

### Note

You must call DISPLAYCURSOR($GCURSORON) to make the cursor visible after calling SETWINDOWCONFIG.

## Example

     USE IFQWIN
     TYPE (windowconfig) wc
     LOGICAL status /.FALSE./
     ! Set the x & y pixels to 800X600 and font size to 8x12
     wc%numxpixels  = 800
     wc%numypixels  = 600
     wc%numtextcols = -1
     wc%numtextrows = -1
     wc%numcolors   = -1
     wc%title= "This is a test"C
     wc%fontsize = Z'0008000C'
     status = SETWINDOWCONFIG(wc)  ! attempt to set configuration with above values
        ! if attempt fails, set with system estimated values
     if (.NOT.status) status = SETWINDOWCONFIG(wc)

Parent topic: QuickWin Library Routines

## See Also

DISPLAYCURSOR
GETWINDOWCONFIG