Callback-Window

The window callback function is used to process messages sent to the
window. Multiple windows may share the same callback. The format of
the callback is:

SL_CALLBACK WORD window_callback(struct WinMsg *);

The callback is passed a pointer to a struct WinMsg. The callback uses
this to process events that have occured in that window. For each message
all fields in the WinMsg structure contain valid data.The mouse coords, qualifier, and repeat fields are filled in for each message type. These
values are as close to the current state as the library can make them.

This is a list of the messages a callback will recieve:

WINMSG_CLOSE - occurs when a window's close gadget is selected. This
does not close the window, but rather tells the window that
the user has requested the window to close.

WINMSG_SIZE - occurs when a window has been resized.

WINMSG_REFRESH - occurs when a window needs to be refreshed. The data
field points to an array of 4 WORD's that contain the left, top, right, and bottom of the bounding box for the refresh
region.

WINMSG_ACTIVE - occurs when a window becomes active.

WINMSG_INACTIVE - occurs when a window becomes inactive.

WINMSG_LEFTMOUSEDOWN
WINMSG_LEFTMOUSEUP
WINMSG_MIDDLEMOUSEDOWN
WINMSG_MIDDLEMOUSEUP
WINMSG_RIGHTMOUSEDOWN
WINMSG_RIGHTMOUSEUP - occurs when the mouse buttons are pressed or
released. The data field for the DOWN messages contain a
count that represents the number of clicks that occured
previous to this one. This is used to tell if the user double, triple, quadruple, etc. clicked the mouse button.

WINMSG_KEY - occurs when a key in the range of 31-x is pressed on the
keyboard. The data field contains the ASCII value of the key
that was pressed.

WINMSG_SYSKEY - occurs when an ascii key not in the above range or a key
that has no ascii equivalent (help, arrows, function keys) is hit.
The data field holds the key value. It is one of the SYSKEY_xxx
values.

WINMSG_MOUSEMOVE - occurs when the mouse moves and the window has the
WINFLG_REPORTMOUSE flag set to TRUE.

WINMSG_MENU - occurs when a menu selection was made.

WINMSG_OBJECT - occurs when an control has something to report. The data
field may contain information that is specific to the particular
control that was manipulated.

WINMSG_CANCEL - occurs if and only if the window is has set the
WINFLG_CANCELABLE flag. The exact cause of this message varies
from OS to OS. For example, on the Amiga, this message is caused
by presssing the right mouse button.

WINMSG_VERTKNOBTRACK
WINMSG_HORZKNOBTRACK - occurs as the user drags the scroll bar. The data
field holds the current knob position. This is the same value as
returned by getting the WINATTR_HScrollTop or WINATTR_VScrollTop.

WINMSG_VERTKNOBPOSITION
WINMSG_HORZKNOBPOSITION - occurs if the user clicks in the scroll bar box.
The data field holds the current knob position. This is the same
value as returned by getting the WINATTR_HScrollTop or
WINATTR_VScrollTop.

WINMSG_LINEUP
WINMSG_LINEDOWN
WINMSG_LINELEFT
WINMSG_LINERIGHT - occurs when the user clicks on the scroll bar arrows.
This message repeats as long as the user has the arrows pressed.
The data field holds the current knob position. This is the same
value as returned by getting the WINATTR_HScrollTop or
WINATTR_VScrollTop.

WINMSG_OPEN - occurs whenever a window is opened. This will occur when
a window is opened for the first time, when a window is
revealed (via SL_RevealWindow), or when a screen change occurs.

WINMSG_QUALUP
WINMSG_QUALDOWN - occurs whenever the qualifier keys are pressed or
released.

WINMSG_TICK - occurs at an OS determined interval. This will occur at
least once every second.

WINMSG_FOCUSIN - occurs when a window gains the input focus.

WINMSG_FOCUSOUT - occurs when a window loses the input focus.

All messages except WINMSG_REFRESH are blocked (not queued up) when a
window is in a wait state (via SL_AppWaitState). The WINMSG_REFRESH message
is sent though as it occurs.

After the callback has processed the event it returns a value that tells
the event loop whether or not it should exit. Here are the return values:

APP_CONTINUE - tells the event loop to keep going.
APP_QUIT - tells the event loop to exit.

 

Callback-Window  Command Section By Type  url:Callback-Window
  created:2008-03-01 23:36:35   last updated:2008-03-01 23:36:35
  Copyright © 1985-2017 GrasshopperLLC. All Rights Reserved.

User Contributed Comments For Callback-Window
There are no user contributed comments for this page.