class window

superclass(es) object
subclass(es) frame - panel - control
description The window class is the abstract base class for all kinds of windows. It contains methods for showing, hiding, resizing, moving, re-painting of windows.
remarks No instances can be created of this class because it is an abstract class.
see also sizer - showtype constants - postype constants - callbacks

tasks

Each window can have a name, a name is an internal atom that is very useful for finding window instances in a window hierarchy. The method findWindow/2 can find windows based on the name inside a window hierarchy. The name of a window can be set by the method putName/1.

With the method putText/1 a text can be displayed for a window, for a normal window this text appears in the title bar of a window, for a control window the text typically appears inside the control window. The hint of a window is a text that appears inside a separate floating popup window if the user moves the mouse over it. The text of the floating hint can be set by putHint/1.

The method show can be used for displaying and hiding a window, the method show/2 uses constants for determining how the window must be shown.

The following methods are used for retrieving information about the size and position of a window: windowRectangle/1, clientRectangle/1, size/1, leftTop/1, width/1, height/1, x/1, y/1, right/1 and bottom/1. The window rectangle is the area of a window that includes the borders and title bar, the client area is the area inside a window that does not include the borders and title bar. With updateSize/0 a window sends a size message to itself with the same dimensions it already has, this also causes all of its child windows to be correctly resized again

Each window can have two scrollbars, a horizontal and a vertical scrollbar, these scrollbars are not visible until the method showScrollBar/2 is used. More method concerning the scrollbars are: putScrollRange/4, scrollRange/3, putScrollPos/2 and scrollPos/2.

It is possible for each window to capture the mouse, this means that all mouse events are send to the window even if the mouse is outside the window. The method captureMouse/0 can be used for that. To release the capture of the mouse the method releaseCaptureMouse/0 can be used.
The caret of the window is the blinking line that appears inside a window, it is usually used to indicate the current point of inserting text, a caret can be created by createCaret/3 and destroyed by destroyCaret/0. To show and hide a caret use hideCaret/0 and showCaret/0, the position can be set by putCaretPos/1.

Painting on the window is done by responding to the onEraseBackground/1 and onPaint/2 events. The following methods influence the area that is redrawn: invalidate/2, validate/2, invalidateClient/1 and validateClient/0. Invalid areas of a window are redraw and after they were redrawn they have become valid. The area of a window that is invalid and must be redrawn can be retrieved by the method: updateRectangle/1.

If the user closes a window by either the mouse or the keyboard then the onClose/2 event is executed, it is possible by responding to this event to prevent the window from being closed. If a window is being deleted by the del_obj operator then the onClose/2 event is NOT EXECUTED!

Adding drag & drop to a window is easy, call the method putDragAcceptFiles/1 and the window will accept files being dragged over it. This is indicated to the user by the mouse cursor. If one or more files is dropped the onDrop/1 event is executed.

methods

putName(Name)

func Set the name of a window. The name is used to identify a window instance. For instance: by assigning different names to different window controls it is easy to find the correct window instance.
pre The parameter Name must contain a valid Prolog atom.
post The value of the parameter was stored as the name of a window.
arrow.gif (1632 bytes) see also: name/1, findWindow/2, prevSibling/1, nextSibling/1, firstChild/1, findChild/2

name(Output)

func Get the name assigned to the window. The name of a window is not the same as the text of a window, the name is used to identify a window instance.
pre TRUE
post The value of the name of the window is unified with the value of the parameter Output.
arrow.gif (1632 bytes) see also: putName/1, findWindow/2, prevSibling/1, nextSibling/1, firstChild/1, findChild/2

findWindow(Name, Output)

func Search for a (child) window of "this" window with the same name as the value of the parameter "Name". A recursive search for a window is started so the requested window may, for instance, be the child of a child window.
pre The parameter Name must contain a valid Prolog atom.
post If a window with the same name was found inside the window hierarchy of "this" window than a reference to the instance was unified with the value of the parameter Output. If no window was found then no value was unified with Output.
arrow.gif (1632 bytes) see also: putName/1, name/1, prevSibling/1, nextSibling/1, firstChild/1, findChild/2

isControl(Output)

func Determine if the window is derived from the control class.
pre TRUE
post Output is set to true if the window is a control window, else it is set to false.

isPanel(Output)

func Determine if the window is derived from the panel class.
pre TRUE
post Output is set to true if the window is a panel window, else it is set to false.

isFrame

func Determine if the window is derived from the frame class.
pre TRUE
post Output is set to true if the window is a frame window, else it is set to false.

parent(Output)

func Return the parent window of "this" window.
pre TRUE
post The parent window was assigned to the variable Output, if the window has no parent then no value was assigned to Output.

isAncestor(Window, Output)

func Determine if the contents of the variable Window is an ancestor window of "this" window (parent or parent of parent, etc...).
pre The variable Window must refer to an instance of the class Window.
post If the contents of the variable Window is an ancestor of "this" window then true was assigned to Output, else was false assigned.

isChild(Window, Output)

func Determine if the contents of the variable Window is a child window of "this" window.
pre The variable Window must refer to an instance of the class Window.
post If the contents of the variable Window is a child of "this" window then true was assigned to Output, else was false assigned.

prevSibling(Output)

func Get the previous child of the parent window of "this" window.
pre TRUE
post If there is a previous window in the list of child windows then that instance was assigned to Output, else no value was assigned.

nextSibling(Output)

func Get the next child of the parent window of "this" window.
pre TRUE
post If there is a next window in the list of child windows then that instance was assigned to Output, else no value was assigned.

firstChild(Output)

func Get the first child window of "this" window.
pre TRUE
post If the window has no children then no value was assigned to the variable Output, else the first child window was assigned to Output.

findChild(point(X, Y), Output)

func Find the child that contains the specified position. The point structure contains a client coordinate.
pre The variables X and Y must contain integer values.
post The child window that occupies the specified position was assigned to Output, else no value was assigned to Output.

findFrame(Output)

func Find the first frame in the parent window hierarchy of "this" window.
pre TRUE
post The first frame window in the parent hierarchy was assigned to Output, else if no frame window could be found no value was assigned to Output.

show

func Show the window, the window is not centered in any direction, it's position is determined by windows.
pre TRUE
post The window is visible.
arrow.gif (1632 bytes) Calling this method is equal to calling show/2 with the arguments showtype_show and postype_default.

show(showType, posType)

func Show the window, the first argument must be one of the following showtype_... constants, the second argument must be one of the postype_... constants.
pre TRUE
post TRUE

Showtype constants:

hide : Hide the window.
show : Make the window visible.
restore : Restore the window to it's position before minimizing.
min : Minimize the window.
max : Maximize the window.
min_no_active : Minimize the window but not activate it.
restore_no_active Restore the window to it's position before minimizing but not make it active

Postype constants:

default : Windows chooses the initial position of the window.
center_hor : The window is only centered in the horizontal direction..
center_ver : The window is only centered in the vertical direction..
center : The window is centered in the horizontal and vertical direction.

windowRectangle(Output)

func Retrieve the position of the upper-left and lower-right corner of the window, the values are specified in screen coordinates (these are relative to the upper-left corner of the display). The values include the border of the window.
pre TRUE
post A rectangle structure is used for output, for instance: rectangle(12, 12, 190, 250).

clientRectangle(Output)

func Retrieve the dimensions of the client area of the window, this is the area inside the window which can be used for drawing or placing controls in. The returned values are in window coordinates, these coordinates are relative to the upper-left corner of the window.
pre TRUE
post A rectangle structure is used for output, for instance: rectangle(0, 0, 200, 300).

text(Output)

func Retrieve the text of the window..
pre TRUE
post The variable was assigned the text of the window, if the window has no text the variable was not assigned a value.

putText(Input)

func Puts the text of the window. The value of the argument can be an atom enclosed by single quotes, for instance: putText('This is a text with whitespace in it').
pre The input variable must not be empty and contain an atomic value.
post TRUE

putFontRecursive(Font)

func Set the font to use by the window and all children of the window.
pre The variable Font must refer to an instance of the class font.
post The window all of its control will use the specified Font for drawing text.

putFontRecursive(Height, Name, Bold, Italic, Strikethrough, Underline, clr(R, G, B))

func Set the properties of the font to use by the window and all children of the window. The height, name, bold, italic, strikethrough, underline and color properties of the font can be specified. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variables Bold, Italic, Strikethrough and Underline must have boolean values (true or false). The variables R, G and B must be integers in the range [0, 255].
post The properties of the font were changed according to the specified parameters.

putFontRecursive(Height, Name, Bold)

func Set the height, name and bold properties of the font to use by the window and all its children. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variable Bold must have the boolean value true or false.
post The properties of the font were changed according to the specified parameters.

hint(Output)

func Retrieve the hint text of the window, this is the text that appears in a small hint window above the actual window if the cursor (=mouse pointer) is positioned above the window for a few seconds.
pre TRUE
post The output variable remains empty if the window has no hint text, else it is assigned the hint text.

putHint(Input)

func Put the hint text of the window, this text will appear in a small hint window above the actual window if the cursor (=mouse pointer) is positioned above it for a few seconds. The hint text must be enclosed by single quotes if it contains any whitespace or control character.
pre The input variable must not be empty.
post TRUE
arrow.gif (1632 bytes) The interface setting of the prolog interpreter that determines if floating hints are visible influences the hint windows of the prolog program.

hide(YesNo)

func Hide the window, if the boolean value is true the background of the window being hidden is redrawn, else if YesNo is false the background is not updated.
pre The YesNo parameter must be true or false.
post TRUE

isVisible(Output)

func Determine if the window is visible.
pre The Output variable must be empty or contain a boolean-value.
post If the window was visible then Output is set to true, else if the window is hidden then Output will contain false.

close

func Close a window.
pre TRUE
post The window has been closed.
arrow.gif (1632 bytes) The onClose event is executed during this method.

showScrollBar(ScrollBarType, YesNo)

func Show or hide a vertical or horizontal scrollbar of a window.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
The YesNo parameter must contain true or false.
post If YesNo was false then the specified scrollbar is hidden, if YesNo was true the scrollbar is shown.

putScrollRange(ScrollBarType, Min, Max, YesNo)

func Change the scrollbar range of the specified scrollbar. The scrollbar range determines the integer values that correspond to the top (or left) and bottom (or right) positions of a single scrollbar. The difference between the two values also determine how much the scrollbar thumb must move if the user clicks on an area of the scrollbar.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
The Min and Max variables must contain integer values and the YesNo must be true or false.
post If the parameter YesNo was true the scrollbar has redrawn itself, otherwise not.

scrollRange(ScrollBarType, Min, Max)

func Get the scrollbar range of the specified scrollbar. The scrollbar range determines the integer values that correspond to the top (or left) and bottom (or right) positions of a single scrollbar.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
The Min and Max variables must contain integer values or be empty.
post The scrollbar ranges are assigned to the variables Min and Max.

putScrollPos(ScrollBarType, Val)

func Put the position of the thumb inside the scrollbar, the thumb is the control inside the scrollbar that indicates the current position.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
The Val variable must contain an integer value.
post The position of the scrollbar thumb was changed.
arrow.gif (1632 bytes) See putScrollRange/4 for more information.

scrollPos(ScrollBarType, Output)

func Get the position of the thumb inside the scrollbar.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
post The Output variable will contain the position of the scrollbar thumb.
arrow.gif (1632 bytes) See putScrollRange/4 for more information.

putSizeScrollThumb(ScrollBarType, Size, Redraw)

func Change the size of the scrollbar thumb of the specified scrollbar. The scrollbar thumb is the buttton inside the scrollbar which indicates the scroll position.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
The Size variable must be an contain integer value and Redraw must be true or false.
post If the parameter Redraw was true the scrollbar has redrawn itself, otherwise not.

sizeScrollThumb(ScrollBarType, ResultSize)

func Get the size of the scrollbar thumb of the specified scrollbar. The scrollbar thumb is the buttton inside the scrollbar which indicates the scroll position.
pre The ScrollBarType variable must contain one of the following constants:
hor : the horizontal scrollbar;
ver : the vertical scrollbar;
ctrl : a scrollbar control.
post The size of the scrollbar thumb was unified with the parameter ResultSize.

copy

func Copy the text of a window to the clipboard.
pre TRUE
post The clipboard contains the text of a window.

paste

func Paste the text from the clipboard to the window.
pre TRUE
post If the clipboard contains text then that text is assigned to the window.
arrow.gif (1632 bytes) It is not an error if the clipboard contains no text data.

clear

func Clear the text of the window. For edit controls is the current selection cleared.
pre TRUE
post The window contains no text.
arrow.gif (1632 bytes) To clear all the text of an edit control use editControl::clearAll/0.

captureMouse

func Capture the mouse input, all mouse events are send to the window that has the mouse captured. The capture can be released by releaseCaptureMouse/0.
pre TRUE
post The window receives all mouse events.

isMouseCaptured(Output)

func Check if the mouse is captured by the window.
pre TRUE
post If the window has the mouse captured then Output receives the value true, else it is assigned the value false.

releaseCaptureMouse

func Release the capture of the mouse.
pre TRUE
post If the window has the mouse captured then that capture is removed.

createCaret(Width, Height, Output)

func Create a caret for the window, the height and width of the caret are specified in pixels.
pre The Width and Height variables must contain positive integer values.
post If the caret was successfully created then is true assigned to Output, if the method didn't execute successfully then is false assigned to Output.
arrow.gif (1632 bytes) The caret is the blinking bitmap that indicates the position of where text can be inserted. The mouse pointer is called the cursor.

destroyCaret

func Destroy the caret of a window.
pre TRUE
post The window contains no caret.

putCaretPos(point(X, Y))

func Put the position of the caret. The position must be specified in client coordinates.
pre The X and Y variables must contain positive integer values.
post The window contains no caret.

hideCaret

func Hide the caret of the window.
pre TRUE
post TRUE

showCaret

func Show the caret of the window. A caret must have been created by createCaret/3.
pre TRUE
post TRUE

isDestroying(Output)

func Determine if the window is being destroyed.
pre TRUE
post If the window is being destroyed then true is assigned to Output, else it will be assigned false.

updateRectangle(Output)

func Get the update rectangle of the window, this rectangle is the area which needs to be redrawn.
pre TRUE
post The Output variable will be assigned a rectangle structure, for instance: rectangle(12, 12, 190, 250). The rectangle is specified in window coordinates.

isMinimized(Output)

func Determine if the window is minimized, i.e. if only the icon of the window is visible.
pre TRUE
post The Output variable will be assigned true if only the icon is visible, else it will be assigned false.
arrow.gif (1632 bytes) A window that has been minimized can be restored with the method show/2.

isMaximized(Output)

func Determine if the window is maximized, i.e.the window occupies the entire display.
pre TRUE
post The Output variable will be assigned true if it the window is maximized, else it will be assigned false.
arrow.gif (1632 bytes) A window that has been maximized can be restored with the method show/2.

invalidate(Input-rectangle, YesNo)

func Invalidate a rectangular area of the window, the area must be specified in window coordinates, the YesNo parameter determines if the background must be erased before the draw event executes.
pre The input rectangle must be or refer to a rectangle/4 structure. The value of the YesNo parmeter must be true or false.
post The specific rectangle was invalidated, i.e. it will be redrawn.
arrow.gif (1632 bytes) The passed rectangle is marked as 'dirty' and must be redrawn, a paint event is executed for redrawing of the specified area.

validate(Input-rectangle)

func Validate a rectangular area of the window, the area must be specified in window coordinates. A validated area is not marked as 'dirty' and thus no paint event will be executed to have the area redrawn.
pre The input rectangle must be or refer to a rectangle/4 structure. The boolean value must be true or false.
post TRUE

invalidateClient(YesNo)

func Invalidate the complete client area of the window, this is the entire area excluding the border, menu and title bar. If the YesNo paraemeter is true the background will be erased before the paint event executes.
pre The boolean value must be true or false.
post The complete client area of the window has become invalidated.
arrow.gif (1632 bytes) The passed rectangle is marked as 'dirty' and must be redrawn, a paint event is executed for redrawing of the specified area.

validateClient

func Validate the complete client area of the window, the entire area will not be marked for redrawing.
pre TRUE
post TRUE

update

func Start redrawing of the window if the invalid area rectangle is not empty. A paint event is generated to redraw the window.
pre TRUE
post TRUE

forceRedraw

func Redraw the entire client area of the window immediately. A paint event is generated to redraw the window.
pre TRUE
post TRUE

scrollWindow(X, Y, scroll-rectangle, clip-rectangle, to-update-rectangle)

func Scroll a rectangle of a window in a certain direction. The number of pixels to scroll and the direction of scrolling is determined by the parameters X and Y. For instance: if X has the value -10 then the scroll-rectangle is scrolled 10 pixels to the left. Which area to scroll is determined by the scroll-rectangle. The clipping-rectangle is the area which may be altered by the scrolling operation.
pre All parameters except the to-update-rectangle must be integers.
post The to-update-rectangle will be assigned the area that was invalidated by scrolling.

resize(point(X, Y), YesNo)

func Resize the window, the point structure contains the new dimensions of the window, the YesNo parameter determines if the window is redrawn or not.
pre The YesNo paraneter must be true or false.
post The window will have the new size, this is the size of the entire window, including the border, menu and title bar.

move(point(X, Y), YesNo)

func Move the window to a new position, the point structure contains the new position of the window in screen coordinates if the window has no parent window. If the window has a parent then the coordinates are relative to the upper-left corner of the parent window. The YesNo parameter determines if the window is redrawn or not.
pre The Yesno parameter must be true or false.
post The window will be at the new position.

moveAndResize(point(XPos, YPos), point(XDim, YDim), YesNo)

func Move and resize the window, the point(XPos, YPos) structure contains the new position of the window, the point(XDim, YDim) contains the new size of the window, the YesNo parameter determines if the window is redrawn or not.
The XDim and YDim values determine the new size of the window in pixels, not the difference between the two point structures determine the size of the window.
pre The YesNo parameter must be true or false.
post The window will have the new and be at the new position.

bringToTop

func Place the window on top of all other windows that it overlaps, the window is put first on the Z-order stack.
pre TRUE
post The window will be on top of all other windows.

stayOnTop(YesNo)

func Make sure the window will remain on top of the Z-order stack or that it can be overlapped by another window.
pre The YesNo parameter must be true or false.
post If the YesNo parameter is true the window will remain on top of the Z-order stack, else the window can be overlapped by other windows.

sendToBack

func Place the window on the bottom of the Z-order stack.
pre TRUE
post All other windows that can overlap the window will overlap it.

makeForegroundWindow

func The window is put into the foreground and activated, keyboard input is also directed to the window.
pre TRUE
post The window has become the current active window and has the keyboard focus.

size(Output)

func Retrieve the dimensions of the window, these include the border of the window.
pre TRUE
post A point structure is used for output, for instance: point(239, 189).

leftTop(Output)

func Determine the position of the lefttop corner of the window, the position is specified in screen coordinates.
pre TRUE
post The value of the argument Output was unified with a structure point(X, Y), X and Y are the integer screen coordinates of the lefttop of the window.

width(Output)

func Get the width of the window.
pre TRUE
post The Output variable will be assigned the width of the window, this includes the borders of the window.

height(Output)

func Get the height of the window.
pre TRUE
post The Output variable will be assigned the height of the window, this includes the borders, menu and title bar of the window.

x(Output)

func Get the x coordinate of the upper-left corner of the window.
pre TRUE
post The Output variable will be assigned the x coordinate of the upper-left corner of the window. This position is relative to the upper-left corner of the display.

y(Output)

func Get the y coordinate of the upper-left corner of the window.
pre TRUE
post The Output variable will be assigned the y coordinate of the upper-left corner of the window. This position is relative to the upper-left corner of the display.

right(Output)

func Get the x coordinate of the lower-right corner of the window.
pre TRUE
post The Output variable will be assigned the x coordinate of the lower-right corner of the window. This position is relative to the upper-left corner of the display.

bottom(Output)

func Get the y coordinate of the lower-right corner of the window.
pre TRUE
post The Output variable will be assigned the y coordinate of the lower-right corner of the window. This position is relative to the upper-left corner of the display.

clientToScreen(point(X,Y), point(ScreenX, ScreenY))

func Convert a point structure containing client coordinates to a structure with screen coordinates. The client coordinates are relative to the upper-left corner of the window and the screen coordinates are relative to the upper-left corner of the screen.
pre The point(X, Y) must contain values.
post The point(ScreenX, ScreenY) structure will be assigned the screen coordinates.

clientToScreen(rectangle(X,Y, R, L), rectangle(ScreenX, ScreenY, ScreenR, ScreenL))

func Convert a rectangle structure containing client coordinates to a structure with screen coordinates. The client coordinates are relative to the upper-left corner of the window and the screen coordinates are relative to the upper-left corner of the screen.
pre The rectangle(X, Y, R, L) must contain values.
post The rectangle(ScreenX, ScreenY, ScreenR, ScreenL) structure will be assigned the screen coordinates.

screenToClient(point(ScreenX,ScreenY), point(X, Y))

func Convert a point structure containing screen coordinates to a structure with client coordinates. The client coordinates are relative to the upper-left corner of the window and the screen coordinates are relative to the upper-left corner of the screen.
pre The point(ScreenX, ScreenY) must contain values.
post The point(X, Y) structure will be assigned the client coordinates.

screenToClient(rectangle(ScreenX, ScreenY, ScreenR, ScreenL), rectangle(X,Y, R, L))

func Convert a rectangle structure containing screen coordinates to a structure with client coordinates. The client coordinates are relative to the upper-left corner of the window and the screen coordinates are relative to the upper-left corner of the screen.
pre The rectangle(ScreenX, ScreenY, ScreenR, ScreenL) must contain values.
post The rectangle(X, Y, R, L) structure will be assigned the client coordinates.

pointInWindow(point(X, Y), Output)

func Determine if a point, containing screen coordinates, is in the client area of the window.
pre The point(X, Y) must contain screen coordinates.
post If the point lies inside the window then the variable Output is assigned the value true, else it is assigned false.

updateSize

func This method causes a window to send a size message to itself with the dimensions it already has. The effect if this is that all events responding to resizing are executed again. The size of the window does not change.
pre TRUE
post A size message was send to itself.

enable(YesNo)

func Enable or disable a window, a disabled window ignores all input from the user and all controls on a disabled window also not respond to input from the user.
pre The boolean value must be true or false.
post If the value was true then the window will be enabled, else it will be disabled.

isEnabled(Output)

func Determine if a window is enabled or disabled.
pre TRUE
post If the window is enabled the Output variable will be assigned true, else it is assigned false.

activate(Output)

func Activate the window, the active window is the window which is being used by the user, the title bar of the active window is colored differently as compared to the other windows and the active window has the input focus.
pre TRUE
post The window will be the active window.

getFocus

func Get the focus, all keyboard events are send to the window which has the focus.
pre TRUE
post The window will be the window which has the keyboard focus.

hasFocus(Output)

func Determine if the window has the focus, all keyboard events are send to the window which has the focus.
pre TRUE
post If the window has the focus the Output variable will be assigned true, else it is assigned false.

putPopupMenu(PopupMenu, RightMouseButton)

func Assign a popup menu to the window and determine if the popupmenu must appear if the right mouse button was clicked. If the RightMouseButton variable contains true the popupmenu automatically appears if the right mouse button is clicked, else not. The popupmenu is integrated with the default popupmenu, if this is not desired then call the method putAllowDisplayInfo/1 with parameter value false.
pre The variable PopupMenu must refer to a popup menu class instance. The variable RightMouseButton must contain a boolean value.
post The popup menu was assigned to the window.

displayPopupMenu(point(X, Y), Output)

func Display a popup menu at the specified position, the position must be specified in window coordinates.
pre The structure point(X, Y) must refer to an existing coordinate inside the window.
post If the popup menu was successfully displayed then Output is assigned true, else it is assigned false.

popup(Output)

func Get the popup menu instance of the window.
pre TRUE
post If the window has a popup menu then the variable Output will refer to that instance, else the value of Output will not change.

putAllowDisplayInfo(YesNo)

func Allow or stop the frame information menu item from being inserted into the popupmenu of the window.
pre The variable YesNo must contain true or false.
post If the value of YesNo was false no frame information menu item will appear if the right mouse button is pressed over the window, else the frame information menu item is shown.

allowDisplayInfo(Output)

func Check if the frame information menu item may appear over the window.
pre TRUE
post If Output was assigned false no frame information menu item will appear if the right mouse button is pressed over the window, else was true assigned and the frame information menu item may appear.

putDragAcceptFiles(YesNo)

func If the parameter YesNo contains true the window will accept files being dragged over it. The shape of the mouse cursor changes automatically to indicate if a window does or does not accept dragged files.
pre The variable YesNo must contain a boolean value.
post If YesNo was assigned true the window will accept files being dragged over it, else not.

dragAcceptFiles(Output)

func Determine if the window does or does not accept dragged files.
pre TRUE
post If the window accepts files being dragged over it then was true assigned to the variable Output else was false assigned.

backgroundColor(R, G, B)

func Get the background color of the window.
pre TRUE
post The Red, Green and Blue values of the background color if the window were unified with the parameters R, G and B.

callbacks

onCreate(Sender)

func Through this callback it is possible to respond to the creation of the visible window, this event is executed while the create method is being executed.
pre The variable Sender refers to the window instance being created.
post TRUE

onClose(Sender, Output)

func This callback is executed if the window is being closed, it is possible by assigning the correct value to the Output variable to prevent the window from being closed.
pre The variable Sender refers to the window being closed, the Output variable is empty.
post If Output is assigned the value false then the window is NOT closed, if Output is assigned any other value the window is closed.
arrow.gif (1632 bytes) If a window is being deleted by the del_obj operator then the onClose/2 event is NOT EXECUTED!!

onEraseBackground(Sender)

func This callback is executed when the background of the window must be erased.
pre The variable Sender refers to the window of which the background must be erased.
post TRUE
arrow.gif (1632 bytes) The background can often be erased in the onPaint/2 event.

onPaint(Sender, rectangle(X, Y, R, B))

func This callback is executed when a rectangle of the window must be repainted.
pre The variable Sender refers to the window of which the background must be erased. The variables X, Y, R and B contain integer values specifying the rectangle that must be repainted (client coordinates).
post TRUE

onShow(Sender, boolean-value)

func This callback is executed if the visibility state of the window window changes, i.e.  the window is shown or hidden. Thus if a visible window is hidden or vice versa the callback executes.
pre The variable Sender refers to the window being shown or hidden, the second parameter is the value true if the window is being show or it is false if the window is being hidden.
post TRUE
arrow.gif (1632 bytes) If the window is created and it shown hidden then this callback is not executed because the visibility state does not change, it was created hidden and the window remains hidden.

onEnable(Sender)

func Determine if the window is derived from the control class.
pre TRUE
post TRUE

onKBFocus(Sender, boolean-value, Other)

func This callback event is executed when the window receives or looses the keyboard focus. If a window receives the keyboard focus all keys entered are send to the window. The boolean value indicates if the window receives or looses the keyboard focus. First the window loosing the keyboard focus receives the event and then the window gaining the keyboard focus receives the event. The variable Other is filled with the other window that either looses or gains the focus depending on the second parameter.
pre The variable Sender refers to the window loosing or gaining the focus, the second parameter is true if the window gains the focus else it is false. The parameter Other is empty if the other window is a window of another application, else it refers to the prolog clause instance of the window.
post TRUE

onMouseMove(Sender, point(X,Y), Button, keys(Shift, Ctrl), Dragging)

func This callback event is executed when the user moves the mouse over a window. The position of the mouse cursor is contained in the structure point(X, Y). Which button is pressed is determined by the value of Button, this can be either none, left, middle or right. The state of the SHIFT and CTRL keyboard keys are also stated, if for instance the SHIFT key was pressed and the CTRL key not then the structure 'keys' looks like 'keys(true, false)'. If the mouse is being moved while a mouse button was pressed then is Dragging set to true, else it is false.
pre The variable Sender refers to the window over which the mouse button is moved. The value of Button is left, middle or right. Shift and Ctrl contain boolean values describing the state of the keyboard keys during the event. Dragging is also a boolean value.
post TRUE

onMouseDown(Sender, point(X,Y), Button, keys(Shift, Ctrl), Dragging)

func This callback event is executed when the user presses on a mouse button over a window. The position of the mouse cursor is contained in the structure point(X, Y). Which button is pressed is determined by the value of Button, this can be either none, left, middle or right. The state of the SHIFT and CTRL keyboard keys are also stated, if for instance the SHIFT key was pressed and the CTRL key not then the structure 'keys' looks like 'keys(true, false)'. If the mouse is being moved while a mouse button was pressed then is Dragging set to true, else it is false.
pre The variable Sender refers to the window over which the mouse button is pressed. The value of Button is left, middle or right. Shift and Ctrl contain boolean values describing the state of the keyboard keys during the event. Dragging is also a boolean value.
post TRUE
arrow.gif (1632 bytes) The event is executed before the onMouseUp event.

onMouseUp(Sender, point(X,Y), Button, keys(Shift, Ctrl), Dragging)

func This callback event is executed when the user releases a mouse button over a window. The position of the mouse cursor is contained in the structure point(X, Y). Which button was released is determined by the value of Button, this can be either none, left, middle or right. The state of the SHIFT and CTRL keyboard keys are also stated, if for instance the SHIFT and CTRL keys were pressed then the structure 'keys' looks like 'keys(true, true)'. If the mouse is being moved while a mouse button was released then is Dragging set to true, else it is false.
pre The variable Sender refers to the window over which the mouse button was released. The value of Button is left, middle or right. Shift and Ctrl contain boolean values describing the state of the keyboard keys during the event. Dragging is also a boolean value.
post TRUE

onMouseDoubleClick(Sender, point(X,Y), Button, keys(Shift, Ctrl), Dragging)

func This callback event is executed when the user double clicks a mouse button over a window. The position of the mouse cursor is contained in the structure point(X, Y). Which button was released is determined by the value of Button, this can be either none, left, middle or right. The state of the SHIFT and CTRL keyboard keys are also stated, if for instance the SHIFT and CTRL keys were pressed then the structure 'keys' looks like 'keys(true, true)'. If the mouse is being moved while a mouse button was released then is Dragging set to true, else it is false.
pre The variable Sender refers to the window over which the mouse button was double clicked. The value of Button is left, middle or right. Shift and Ctrl contain boolean values describing the state of the keyboard keys during the event. Dragging is also a boolean value.
post TRUE

onClick(Sender)

func This callback event is executed when the user clicks on the left mouse button over a window. Responding to this callback is preferred over using onMouseUp if you want to respond to the user pressing a button.
pre The variable Sender refers to the window over which the left mouse button is clicked.
post TRUE
arrow.gif (1632 bytes) The event is executed after the onMouseUp event.

onKeyDown(Sender, Key-code, keys(Shift, Ctrl))

func This callback event is executed when the user presses a key on the keyboard. The key code of the key pressed is specified in the Key-code variable. The state of the SHIFT and CTRL keys are stated in the structure 'keys', if true is specified the key was pressed, else not and is false specified. The keycode is not equal to the ASCII code, see onChar.
pre The variable Sender refers to the window over which the keyboard key was pressed.
post TRUE
arrow.gif (1632 bytes) The event is executed before the onKeyUp event.

onKeyUp(Sender, Key-code, keys(Shift, Ctrl))

func This callback event is executed when the user releases a key on the keyboard. The key code of the key released is specified in the Key-code variable. The state of the SHIFT and CTRL keys are stated in the structure 'keys', if true is specified the key was pressed, else not and is false specified. The keycode is not equal to the ASCII code, see onChar.
pre The variable Sender refers to the window over which the keyboard key was released.
post TRUE
arrow.gif (1632 bytes) The event is executed after the onKeyDown event.

onChar(Sender, ASCII-code, keys(Shift, Ctrl))

func This callback event is executed when the user releases a key on the keyboard. The ASCII code of the key released is specified in the ASCII-code variable. The state of the SHIFT and CTRL keys are stated in the structure 'keys', if true is specified the key was pressed, else not and is false specified. The difference between the onKeyDown, onKeyUp and the onChar events is that the keycode and the states of the CTRL and SHIFT keys are translated into an ASCII code
pre The variable Sender refers to the window over which the keyboard key was released.
post TRUE
arrow.gif (1632 bytes) The event is executed after the onKeyDown event but before the onKeyUp event.

onMove(Sender, point(X, Y))

func This callback event is executed when a window is moved.
pre The variable Sender refers to the window which was moved and the point structure contains the coordinates of the upper-left corner of the window. The coordinates are screen coordinates.
post TRUE

onSize(Sender, point(X, Y))

func This callback event is executed when a window is resized.
pre The variable Sender refers to the window which was resized, the point structure contains the new dimensions of the window.
post TRUE

onActivate(Sender, boolean-value)

func This callback event is executed when a window is activated, a window is activated when the user selects a control on the window or just selects the window using the mouse. The title bar of the active window is colored differently than the title bars of the other windows. This event is send to a window if it becomes the active window and to the the window that is made inactive.
pre The variable Sender refers to the window which is becoming inactive or active, the boolean value is false if the window is becoming inactive, else if the window becomes the active window the boolean value is TRUE
post TRUE
arrow.gif (1632 bytes) The window that is made inactive first receives an onActivate event with false as the boolean value, after that event the window that becomes the active window receives the onActivate event with true as boolean value.

onSetCursor(Sender, point(X,Y), boolean-value)

func This callback event is executed when the mouse is moved over a window, it also states if the mouse is over the client area of the window or for instance over the title bar of a window.
pre The variable Sender refers to the window over which the mouse was moved, the point structure contains the position of the mouse in window coordinates. The boolean value is true if the mouse is moved over the client area, else it is false.
post TRUE
arrow.gif (1632 bytes) With this callback a decision can be made which mouse cursor to display.

onHScroll(Sender, ScrollCode, Pos)

func This callback event is executed when the horizontal scrollbar is used.
pre The variable Sender refers to the window which scrollbar was moved, the ScrollCode variable indicates which part of the scrollbar was used, it can be one of the following values:
top: the user wants to scroll to the top;
bottom: the user wants to scroll to the bottom;
pageup: the user wants to scroll to go a page up;
pagedown: the user wants to scroll to go a page down;
lineup: the user wants to scroll to go a line up;
linedown: the user wants to scroll to go a line up;
pos: a new absolute position, the Pos variable contains the new position;
tracking: the user is pressing the left mouse button and moving the track button of the scrollbar, the Pos variable contains the new position;
The Pos variable contains a value if the ScrollCode is 'pos' or 'tracking'.
post TRUE
arrow.gif (1632 bytes) The 'tracking' scrollcode is useful for immediate responding to the actions of the user.

onVScroll(Sender, ScrollCode, Pos)

func This callback event is executed when the vertical scrollbar is used.
pre The variable Sender refers to the window which scrollbar was moved, the ScrollCode variable indicates which part of the scrollbar was used, it can be one of the following values:
top: the user wants to scroll to the top;
bottom: the user wants to scroll to the bottom;
pageup: the user wants to scroll to go a page up;
pagedown: the user wants to scroll to go a page down;
lineup: the user wants to scroll to go a line up;
linedown: the user wants to scroll to go a line up;
pos: a new absolute position, the Pos variable contains the new position;
tracking: the user is pressing the left mouse button and moving the track button of the scrollbar, the Pos variable contains the new position;
The Pos variable contains a value if the ScrollCode is 'pos' or 'tracking'.
post TRUE
arrow.gif (1632 bytes) The 'tracking' scrollcode is useful for immediate responding to the actions of the user.

onCommand(Sender, CommandCode)

func This callback event is executed when a menu item was chosen by the user.
pre The variable Sender refers to the window which contained the menu item and the CommandCode variable contains the identifier of the menu item that was selected.
post TRUE

onMenuSelect(Sender, CommandCode)

func This callback event is executed when another menu item is selected.
pre The variable Sender refers to the window which contained the menu item and the CommandCode variable contains the identifier of the menu item that was selected.
post TRUE
arrow.gif (1632 bytes) This event is usually handled to provide additional help about the functionality of a menu item.

onInitPopupMenu(Sender, point(X, Y))

func This callback event is executed just before a floating popup menu appears. It is possible to alter the popup menu during the processing of this event.
pre The variable Sender refers to the window which will contain the popup menu and the point structure contains the position of where the popup menu will appear.
post TRUE

onDrop(Sender, point(X, Y), InClientArea, NumFiles, Files)

func This callback event is executed when one or more dragged files was dropped on a window that accepts dragged files.
pre The variable Sender refers to the window on which the files were dropped. The point structure contains the coordinates of where the mouse button was released. The parameter InClientArea contains true if the drop event occurred in the client area of the window, else it contains false. The parameter NumFiles contains the number of files being dropped and the parameter Files is a list of filenames. The filenames are atomic values enclosed by single quotes.
post TRUE
arrow.gif (1632 bytes) See also putDragAcceptFiles/1.