windowslib
A window is a Blitz object, numbered from 0: Window 0,... opens window
0 on the screen in use, CloseWindow 0 closes it. Opening a window makes
it the used window, and also the one that Print, NPrint, Inkey$
and Edit$ work with; Use Window, WindowOutput and WindowInput
choose another. Most commands of this library work on the used window,
such as WLocate, WCls, WPlot or WTitle.
All windows share one message port. WaitEvent waits for the next
event of any window and Event takes one without waiting; both return
its IDCMP class, and EventWindow, GadgetHit, MenuHit, ItemHit,
SubHit, EventCode and EMouseX/EMouseY then tell what it was. The
events a window reports are set with DefaultIDCMP, AddIDCMP and
SubIDCMP before it is opened.
Opening windows (Window, WindowTags), the event commands WaitEvent,
Event, EventCode, EventQualifier and MButtons, the drawing
commands such as WPlot, WLine or WCls, and WindowFont,
WPointer, Activate and the menu switches work in Amiga mode only;
the compiler refuses them in Blitz mode. With runtime error checking, using a window that is not open is
the error “Uninitialized Window”.
Based on the windowslib guide by Acid Software.
Library number 138. It manages Window objects, by default at most 5 (the compiler options set the maximum).
Commands
Activate
Makes the window the active one, the one that gets the keyboard.
Statement. Help text: Window#
Arguments: .w
AddIDCMP
Adds IDCMP flags to those of the windows opened from now on.
Statement. Help text: IDCMP_Flags
Arguments: .l
BitMaptoWindow
Copies a bitmap, or an area of it, into a window.
Statement. Help text: Bitmap#,Window#[,srcx,srcy,destx,desty,wid,height]
2 forms:
.w, .w.w, .w, .w, .w, .w, .w, .w, .w
CatchDosErrs
Makes the system’s DOS requesters appear on the used window’s screen.
Statement. No help text.
No arguments.
CloseWindow
Closes the window. Its waiting events are dropped; those of the other windows stay. Nothing happens if the window is not open.
Statement. Help text: Window#
Arguments: .w
Cursor
The cursor of Edit$ in a window, a block for a negative value, otherwise an underline one line thicker than the value.
Statement. Help text: Thickness : <0 - block, >=0 - underline thickness
Arguments: .w
DefaultIDCMP
Sets the IDCMP flags, the kinds of events, of the windows opened from now on.
Statement. Help text: IDCMP_Flags
Arguments: .l
With runtime error checking, 0 is the error “IDCMP must not be 0”.
Without DefaultIDCMP, windows report
$2|$4|$8|$20|$40|$100|$200|$400|$40000|$80000. Whoever changes the
flags must keep the ones the program needs: a window with menus needs
$100, or menu choices are never reported. The classes:
| Class | Event |
|---|---|
$2 | the window has a new size |
$4 | the contents of the window must be drawn again |
$8 | a mouse button |
$10 | the mouse has moved |
$20 | a gadget is pressed |
$40 | a gadget is released |
$100 | a menu choice |
$200 | the close gadget |
$400 | a key |
$8000 | a disk is inserted |
$10000 | a disk is removed |
$40000 | the window is activated |
$80000 | the window is deactivated |
Editat
The cursor position at which the last Edit$ in a window ended.
Function, result .w. No help text.
No arguments.
EditExit
The character that ended the last Edit$ in a window, or -1 if another event ended it.
Function, result .w. No help text.
No arguments.
EditFrom
Without an argument, the following Edit$ calls in a window start at the beginning and end only with Return; with a position, they start there and also end at any other event and at keys the editor does not use.
Statement. Help text: [Characterpos]
2 forms:
- no arguments
.w
EMouseX
The mouse x position at the last event.
Function, result .w. No help text.
No arguments.
EMouseY
The mouse y position at the last event.
Function, result .w. No help text.
No arguments.
Event
The IDCMP class of the next event of any window, or 0 if there is none (also for a menu event without a choice or a key without a character); it does not wait.
Function, result .l. No help text.
No arguments.
After a string gadget is pressed, the next Event reports a “gadget
up” for it at once, as in the original; the real one when the
entry ends is then not reported again. A menu choice of
several items gives a further menu event for the next item, with the
same qualifier.
EventCode
The IDCMP code of the last event.
Function, result .w. No help text.
No arguments.
EventQualifier
The qualifier of the last event, such as the shift keys held down.
Function, result .w. No help text.
No arguments.
EventWindow
The number of the window of the last event.
Function, result .w. No help text.
No arguments.
FlushEvents
Drops all waiting events, or only those of one IDCMP class.
Statement. Help text: [IDCMP_Flag]
2 forms:
- no arguments
.l
GadgetHit
The number of the gadget of the last gadget event. Gadgets in different windows can have the same number; EventWindow tells the window.
Function, result .w. No help text.
No arguments.
GetSuperBitMap
Copies the contents of the used window into its super bitmap.
Statement. No help text.
No arguments.
InnerCls
Clears the inside of the used window, within its borders, with colour 0 or the given colour.
Statement. Help text: [Colour]
2 forms:
- no arguments
.w
InnerHeight
The height of the inside of the used window, within its borders.
Function, result .w. No help text.
No arguments.
InnerWidth
The width of the inside of the used window, within its borders.
Function, result .w. No help text.
No arguments.
ItemHit
The item number of the last menu event, or -1.
Function, result .w. No help text.
No arguments.
MButtons
The next mouse button event of the input window.
Function, result .w. No help text.
No arguments.
MenuHit
The menu number of the last menu event, or -1 if there was none.
Function, result .w. No help text.
No arguments.
Menus
Switches the menus of the windows on or off, as MenusOn and MenusOff.
Statement. Help text: On|Off
Arguments: .w
MenusOff
Switches the menus of the windows off.
Statement. No help text.
No arguments.
MenusOn
Switches the menus of the windows on again.
Statement. No help text.
No arguments.
PositionSuperBitMap
Moves the view of a super bitmap window to a position in its bitmap.
Statement. Help text: x,y
Arguments: .w, .w
PutSuperBitMap
Copies the super bitmap into the used window.
Statement. No help text.
No arguments.
Qualifier
The low 8 bits of the qualifier of the last key read from a window, such as the shift keys held down.
Function, result .l. No help text.
No arguments.
RastPort
The address of the window’s RastPort, for calling the graphics library directly.
Function, result .l. Help text: (Window#)
Arguments: .w
RawKey
The raw key code of the last key read from a window.
Function, result .w. No help text.
No arguments.
SetEventFilter
Two routines of the program that see every message before and after it is taken into the event list; the first can drop it.
Statement. Help text: preprocess,postprocess
Arguments: .l, .l
SizeLimits
The smallest and largest size of the windows opened from now on.
Statement. Help text: Min Width,Min Height,Max Width,Max Height
2 forms:
.w.w, .w, .w, .w
SubHit
The subitem number of the last menu event, or -1.
Function, result .w. No help text.
No arguments.
SubIDCMP
Removes IDCMP flags from those of the windows opened from now on.
Statement. Help text: IDCMP_Flags
Arguments: .l
WaitEvent
Waits for the next event of any window and returns its IDCMP class. As a statement, it only waits. The class is a long value, so keep it in a long variable, such as ev.l=WaitEvent.
Statement or function, result .l. No help text.
No arguments.
WBlit
Draws a shape into the used window, with its mask if it has one.
Statement. Help text: Shape#,x,y
Arguments: .w, .w, .w
WBox
Draws a filled rectangle in the used window.
Statement. Help text: X1,Y1,X2,Y2,Colour
Arguments: .w, .w, .w, .w, .w
WCircle
Draws a circle in the used window.
Statement. Help text: X,Y,Radius,Colour
Arguments: .w, .w, .w, .w
WCls
Clears the used window with colour 0 or the given colour.
Statement. Help text: [Colour]
2 forms:
- no arguments
.w
WColour
The text colours of the output into windows, the foreground and optionally the background; the background colour is also used by the drawing commands.
Statement. Help text: Foreground Colour[,Background Colour]
2 forms:
.w.w, .w
WCursX
The x position of the text cursor in the used window.
Function, result .w. No help text.
No arguments.
WCursY
The y position of the text cursor in the used window.
Function, result .w. No help text.
No arguments.
WEllipse
Draws an ellipse in the used window.
Statement. Help text: X,Y,X Radius,Y Radius,Colour
Arguments: .w, .w, .w, .w, .w
Window
Opens a window on the screen in use, with position, size, Intuition window flags, title and the detail and block pens, optionally with a gadget list and a bitmap for a super bitmap window. A window that is already open with this number is closed first. The new window becomes the used, input and output window.
Statement. Help text: Window#,X,Y,Width,Height,Flags,Title$,Dpen,Bpen[,GadgetList#[,BitMap#]]
3 forms:
.w, .w, .w, .w, .w, .l, $, .w, .w.w, .w, .w, .w, .w, .l, $, .w, .w, .w.w, .w, .w, .w, .w, .l, $, .w, .w, .w, .w
If Intuition cannot open the window, the error is “Couldn’t Open
Window”. A super bitmap window (flag $80) needs the form with
BitMap#.
The flags are those of Intuition, combined with |; for example
$1|$2|$1000 gives a window with a sizing gadget and a drag bar that
is active when it opens:
| Flag | Effect |
|---|---|
$1 | sizing gadget in the bottom right corner |
$2 | the window can be dragged by its title bar |
$4 | depth gadget, to move the window behind or in front of others |
$8 | close gadget |
$10, $20 | with $400 and $1, keep a margin for the sizing gadget at the right or the bottom |
$80 | super bitmap window: the window shows a bitmap of its own, which may be larger and which keeps the contents |
$100 | backdrop window, behind all others (without $4) |
$400 | the border is kept apart from the inner area, so drawing cannot overwrite it; this takes more memory |
$800 | no border |
$1000 | the window is active when it opens |
WindowFont
Sets the font of the used window, optionally with a soft style.
Statement. Help text: IntuiFont# [,SoftStyle]
2 forms:
.w.w, .l
WindowHeight
The height of the used window.
Function, result .w. No help text.
No arguments.
WindowInput
Makes Inkey$, Edit$ and the other input commands read from the window.
Statement. Help text: Window#
Arguments: .w
WindowOutput
Makes Print and NPrint write into the window.
Statement. Help text: Window#
Arguments: .w
WindowTags
Opens a window like Window, but through Intuition’s tag list call; extra tags come as tag and data pairs, or as the address of a tag list.
Statement. Help text: Window#,Flags,Title$ [,&TagList] or [[,Tag,Data]...]
3 forms:
.w, .l, $.w, .l, $, .l.w, .l, $, { .l, .l }...
With runtime error checking, more than 15 tag and data pairs given as arguments are the error “Too Many Tags”; a longer list can be given as the address of a tag list, which takes any number of tags.
WindowWidth
The width of the used window.
Function, result .w. No help text.
No arguments.
WindowX
The x position of the used window on its screen.
Function, result .w. No help text.
No arguments.
WindowY
The y position of the used window on its screen.
Function, result .w. No help text.
No arguments.
WJam
The drawing mode of text and graphics in windows, one of the graphics library’s draw modes.
Statement. Help text: Jammode
Arguments: .w
WLeftOff
The width of the left border of the used window.
Function, result .w. No help text.
No arguments.
WLine
Draws lines through two or more points in the used window.
Statement. Help text: X1,Y1,X2,Y3[,Xn,Yn...],Colour
Arguments: { .w, .w }..., .w
WLocate
Places the text cursor of the used window, relative to its inside.
Statement. Help text: Cursor x,Cursor y
Arguments: .w, .w
WMouseX
The x position of the mouse in the used window.
Function, result .w. No help text.
No arguments.
WMouseY
The y position of the mouse in the used window.
Function, result .w. No help text.
No arguments.
WMove
Moves the used window and waits until Intuition has moved it.
Statement. Help text: X,Y
Arguments: .w, .w
With runtime error checking, a negative position or one where the window does not fit on its screen is the error “Can’t move Window”.
WPlot
Sets a point in the used window.
Statement. Help text: X,Y,Colour
Arguments: .w, .w, .w
WPointer
Uses a shape as the mouse pointer of the used window.
Statement. Help text: Shape#
Arguments: .w
WPrintScroll
Scrolls the inside of the used window up if the text cursor is below its last line, so that the cursor line fits.
Statement. No help text.
No arguments.
WScroll
Scrolls an area of the used window by the given distances.
Statement. Help text: X1,Y1,X2,Y2,Delta X,Delta Y
Arguments: .w, .w, .w, .w, .w, .w
WSize
Changes the size of the used window and waits until Intuition has done it.
Statement. Help text: Width,Height
Arguments: .w, .w
With runtime error checking, a size of 0 or less, a window that would
leave the screen, or, for a window with a sizing gadget, a size
outside the limits set with SizeLimits is the error “Can’t Size
Window”.
WTitle
Sets the titles of the used window and of its screen.
Statement. Help text: windowtitle$,screentitle$
Arguments: $, $
WTopOff
The height of the top border of the used window.
Function, result .w. No help text.
No arguments.