AES Function Reference


Application Services Library


The Application Services Library provides general use functions used in locating and working with other resident applications in addition to providing AES initialization and termination code. The members of the Application Services Library are:

appl_exit()

appl_find()

appl_getinfo()

appl_init()

appl_read()

appl_search()

appl_tplay()

appl_trecord()

appl_write()

appl_exit()

WORD appl_exit( VOID )
appl_exit() should be called at the termination of any program initialized with appl_init().
Opcode19 (0x13)
AvailabilityAll AES versions.
Binding
return crys_if(0x13);
Return Valueappl_exit() returns 0 if an error occurred or non-zero otherwise.
CommentsThe proper procedure for handling an error from this function is currently undefined.
See Alsoappl_init()


appl_find()

WORD appl_find( fname )

CHAR *fname;
appl_find() searches the AES's current process list for a program named fname and, if present, returns the application identifier of the process.
Opcode13 (0x0D)
AvailabilityAll AES versions.
Parametersfname is a pointer to a null-terminated ASCII string containing a valid GEMDOS filename (not including an extension) padded with blanks to be exactly 8 characters long (not including the NULL).
Binding
addrin[0] = fname;

return crys_if(0x0D);
Return Valueappl_find() returns the application identifier of the process if it is found or -1 otherwise.
Version NotesAES versions from 4.0 add several extensions to this call for the benefit of MultiTOS as follows: If the upper word of the CHAR * is 0xFFFF, the lower word is assumed to be the MiNT id and appl_find() will return the AES application identifier.

If the upper word of the CHAR * is 0xFFFE, the lower word is assumed to be the AES application identifier and the MiNT id is returned.

If the upper word of the CHAR * is 0x0000, the current processes' application identifier is returned.This functionality only exists if the AES version is 4.0 and above and appl_getinfo() indicates that it is available.

See Alsoappl_write(), appl_init()


appl_getinfo()

WORD appl_getinfo(ap_gtype, ap_gout1, ap_gout2, ap_gout3, ap_gout4 )

WORD ap_gtype;

WORD *ap_gout1, *ap_gout2, *ap_gout3, *ap_gout4;
appl_getinfo() returns information about the AES.
Opcode130 (0x82)
AvailabilityAvailable as of AES version 4.00.
Parametersap_gtype specifies the type of information to be returned in the shorts pointed to by ap_gout1, ap_gout2, ap_gout3, and ap_gout4 as follows:
Name
Value
Returns
AES_LARGEFONT
0
AES Large Font Information

ap_gout1 is filled in with the AES font's point size.

ap_gout2 is filled in with the font id.

ap_gout3 is a code indicating the type of font:

SYSTEM_FONT (0) is the system font

OUTLINE_FONT (1) is an outline font

ap_gout4 is unused.

AES_SMALLFONT
1
AES Large Font Information

Same as above for the current small font.

AES_SYSTEM
2
AES System Specifics

ap_gout1 is filled in with the resolution number (as would be returned by Getrez()).

ap_gout2 is filled in with the number of colors supported by the AES object library.

ap_gout3 is 0 if color icons are not supported or 1 if they are.

ap_gout4 is 0 to indicate that the extended resource file format is not supported or 1 if it is.

AES_LANGUAGE
3
AES Globalization

ap_gout1 is filled in with the current AES language code as follows:Name ap_gout1 LanguageAESLANG_ENGLISH 0 English

AESLANG_GERMAN 1 German

AESLANG_FRENCH 2 French

- 3 (Reserved)

AESLANG_SPANISH 4 Spanish

AESLANG_ITALIAN 5 Italian

AESLANG_SWEDISH 6 Swedishap_gout2, ap_gout3, and ap_gout4 are unused.

AES_PROCESS
4
AES Multiple Process Support

ap_gout1 is 0 to indicate the use of non-pre-emptive multitasking and 1 to indicate the use of pre-emptive multitasking.

ap_gout2 is 0 if appl_find() cannot convert between MiNT and AES id's and 1 to indicate that it can.

ap_gout3 is 0 if appl_search() is not implemented and 1 if it is.

ap_gout4 is 0 if rsrc_rcfix() is not implemented and 1 if it is.

AES_PCGEM
5
AES PC-GEM Features

ap_gout1 is 0 if objc_xfind() is not implemented and 1 if it is.

ap_gout2 is currently reserved.

ap_gout3 is 0 if menu_click() is not implemented and 1 if it is.

ap_gout4 is 0 if shel_rdef() and shel_wdef() are not implemented and 1 if they are.

AES_INQUIRE
6
AES Extended Inquiry Functions

ap_gout1 is 0 if -1 is not a valid ap_id parameter to appl_read() or 1 if it is.

ap_gout2 is 0 if -1 is not a valid length parameter to shel_get() or 1 if it is.

ap_gout3 is 0 if -1 is not a valid mode parameter to menu_bar() or 1 if it is.

ap_gout4 is 0 if MENU_INSTL is not a valid mode parameter to menu_bar() or 1 if it is.

-
7
Currently reserved.
AES_MOUSE
8
AES Mouse Support

ap_gout1 is 0 to indicate that mode parameters of 258-260 are not supported by graf_mouse() and 1 if they are.

ap_gout2 is 0 to indicate that the application has control over the mouse form and 1 to indicate that the mouse form is maintained by the AES on a per-application basis.

ap_gout3 and ap_gout4 are currently unused.

AES_MENU
9
AES Menu Support

ap_gout1 is 0 to indicate that sub-menus are not supported and 1 if MultiTOS style sub-menus are.

ap_gout2 is 0 to indicate that popup menus are not supported and 1 if MultiTOS style popup menus are.

ap_gout3 is 0 to indicate that scrollable menus are not supported and 1 if MultiTOS style scrollable menus are.

ap_gout4 is 0 to indicate that the MN_SELECTED message does not contain object tree information in msg[57] and 1 to indicate that it does.

AES_SHELL
10
AES Shell Support

ap_gout1 & 0x00FF indicates the highest legal value for the mode parameter of shel_write(). ap_gout1 & 0xFF00 indicate which extended shel_write() mode bits are supported.

ap_gout2 is 0 if shel_write() with a mode parameter of 0 launches an application or 1 if it cancels the previous shel_write().

ap_gout3 is 0 if shel_write() with a mode parameter of 1 launches an application immediately or 1 if it takes effect when the current application exits.

ap_gout4 is 0 if ARGV style parameter passing is not supported or 1 if it is.

AES_WINDOW
11
AES Window Features

ap_gout1 is a bitmap of extended modes supported by wind_get() and wind_set() (if a bit is set, it is supported) as follows: Bit mode

0 WF_TOP returns window below the top also.

1 wind_get( WF_NEWDESK, ... ) supported.

2 WF_COLOR get/set.

3 WF_DCOLOR get/set.

4 WF_OWNER get/set.

5 WF_BEVENT get/set.

6 WF_BOTTOM set.

7 WF_ICONIFY set.

8 WF_UNICONIFY set.

9-15 Unused

ap_gout2 is current unused.

ap_gout3 is a bitmap of supported window behaviors (if a bit is set, it is supported) as follows:

Bit Behaviour

0 Iconifier gadget present.

1 Bottomer gadget present.

2 shift-click sends window to bottom.

3 "hot" close box supported.

4-15 Unused

ap_gout4 is currently unused.

AES_MESSAGE
12
AES Extended Messages

ap_gout1 is a bitmap of extra messages supported (if a bit is set, it is supported) as follows: Bit Message

0 WM_NEWTOP is meaningful.

1 WM_UNTOPPED is sent.

2 WM_ONTOP is sent.

3 AP_TERM is sent.

4 Shutdown and resolution change messages.

5 CH_EXIT is sent.

6 WM_BOTTOMED is sent.

7 WM_ICONIFY is sent.

8 WM_UNICONIFY is sent.

9 WM_ALLICONIFY is sent.

10-15 Unused

ap_gout2 is a bitmap of extra messages supported. Current all bits are unused.

ap_gout3 is a bitmap indicating message behaviour (if a bit is set, the behaviour exists) as follows:

Bit Message

0 WM_ICONIFY message gives coordinates.

1-15 Unused

ap_gout4 is currently unused.

AES_OBJECT
13
AES Extended Objects

ap_gout1 is 0 if 3D objects are not supported or 1 if they are.

ap_gout2 is 0 if objc_sysvar() is not present, 1 if MultiTOS v1.01 objc_sysvar() is present, or 2 if extended objc_sysvar() is present.

ap_gout3 is 0 if the system font is the only font supported or 1 if GDOS fonts are also supported.

ap_gout4 is reserved for OS extensions.

AES_FORM
14
AES Form Support

ap_gout1 is 0 if 'flying dialogs' are not supported or 1 if they are.

ap_gout2 is 0 if keyboard tables are not supported or 1 if Mag!X style keyboard tables are supported.

ap_gout3 is 0 if the last cursor position from objc_edit() is not returned or 1 if it is.

ap_gout4 is currently reserved.

Binding
intin[0] = ap_gtype;

crys_if(0x82);

*ap_gout1 = intout[1];
*ap_gout2 = intout[2];
*ap_gout3 = intout[3];
*ap_gout4 = intout[4];

return intout[0];
Return Valueappl_getinfo() returns 1 if an error occurred or 0 otherwise.
Version NotesUsing an ap_gtype value of 4 and above is only supported as of AES version 4.1.
CommentsMany of the ap_gtype return values identify features of TOS not supported by Atari but for the benefit of third-party vendors. You should contact the appropriate third-party for documentation on these functions.
See Alsoappl_init()


appl_init()

WORD appl_init( VOID )
appl_init() should be the first function called in any application that intends to use GEM calls.
Opcode10 (0x0A)
AvailabilityAll AES versions.
ParametersThe function as prototyped accepts no parameters, however, all 'C' compilers use this call to set up internal information as well as to update the applications' global array.
Binding
return crys_if(0x0A);
Return Valueappl_init() returns the applications' global identifier if successful or -1 if the AES cannot register the application. If successful, the global identifier should be stored in a global variable for later use.

Besides the return value, the AES fills in the application's global array (to reference the global array see your programming languages' manual).

Name
global[x]
Meaning
_AESversion
0
AES version number.
_AESnumapps
1
Number of concurrent applications possible (normally 1). MultiTOS will return -1.
_AESapid
2
Application identifier (same as appl_init() return value).
_AESappglobal
3-4
LONG global available for use by the application.
_AESrscfile
5-6
Pointer to the base of the resource loaded via rsrc_load().
-
7-12
Reserved
_AESmaxchar
13
Current maximum character used by the AES to do vst_height() prior to writing to the screen. This entry is only present as of AES version 0x0400.
_AESminchar
14
Current minimum character used by the AES to do vst_height() prior to writing to the screen. This entry is only present as of AES version 0x0400.
Version NotesSee above.
See Alsoappl_exit()


appl_read()

WORD appl_read( ap_id, length, message )

WORD ap_id, length;

VOIDP message;
appl_read() is designed to facilitate inter-process communication between processes running under the AES. The call will halt the application until a message of sufficient length is available (see version notes below).
Opcode11 (0x0B)
AvailabilityAll AES versions.
Parametersap_id is your application identifier as returned by appl_init(). length is the length (in bytes) of the message to read. message is a pointer to a memory buffer where the incoming message should be copied to.
Binding
intin[0] = ap_id;
intin[1] = length;

addrin[0] = message;

return crys_if(0x0B);
Return Valueappl_read() returns 0 if an error occurred or non-zero otherwise.
Version NotesIf the AES version is 4.0 or higher and appl_getinfo() indicates that this feature is supported, ap_id takes on an additional meaning. If APR_NOWAIT (-1) is passed instead of ap_id, appl_read() will return immediately if no message is currently waiting.
CommentsNormally this call is not used. evnt_multi() or evnt_mesag() is used instead for standard message reception. appl_read() is required for reading messages that are long and/or of variable length.

It is recommended that message lengths in multiples of 16 bytes be used.

See Alsoappl_write()


appl_search()

WORD appl_search( mode, fname, type, ap_id )

WORD mode;

CHAR *fname;

WORD *type,*ap_id;
appl_search() provides a method of identifying all of the currently running processes.
Opcode18 (0x12)
AvailabilityAvailable only in AES versions 4.0 and above when appl_getinfo() indicates its presence.
Parametersmode specifies the search mode as follows:
Name
mode
Meaning
APP_FIRST
0
Return the filename of the first process
APP_NEXT
1
Return the filename of subsequent processes
fname should point to a memory location at least 9 bytes long to hold the 8 character process filename found and the NULL byte. type is a pointer to a WORD into which will be placed the process type as follows:
Name
type
Meaning
APP_SYSTEM
0x01
System process
APP_APPLICATION
0x02
Application
APP_ACCESSORY
0x04
Accessory
APP_SHELL
0x08
The type parameter is actually a bit mask so it is possible that a process containing more than one characteristic will appear. The currently running shell process (usually the desktop) will return a value of APP_APPLICATION | APP_SHELL (0x0A).

ap_id is a pointer to a word into which will be placed the processes' application identifier.

Binding
intin[0] = mode;

addrin[0] = fname;
addrin[1] = type;
addrin[2] = ap_id;

return crys_if(0x12);
Return Valueappl_search() returns 0 if no more applications exist or 1 when more processes exist that meet the search criteria.


appl_tplay()

WORD appl_tplay( mem, num, scale )

VOIDP mem;

WORD num, scale;
appl_tplay() plays back events originally recorded with appl_trecord().
Opcode14 (0x0E)
AvailabilityAll AES versions.
Parametersmem is a pointer to an array of EVNTREC structures (see appl_trecord()). num indicates the number of EVNTREC's to play back.

scale indicates on a scale of 1 to 10000 how fast the AES will attempt to play back your recording. A value of 100 will play it back at recorded speed. A value of 200 will play the events back at twice the recorded speed, and 50 will play back the events at half of the recorded speed. Other values will respond accordingly.

Binding
intin[0] = num;
intin[1] = scale;

addrin[0] = mem;

return crys_if(0x0E);
Return Valueappl_tplay() always returns 1 meaning no error occurred.
CaveatsThis function does not work correctly on AES versions less than 1.40 without a patch program available from Atari Corp.
See Alsoappl_trecord()


appl_trecord()

WORD appl_trecord( mem, num )

VOIDP mem;

WORD num;
appl_trecord() records AES events for later playback.
Opcode15 (0x0F)
AvailabilityAll AES versions.
Parametersmem points to an array of num EVNTREC structures into which the AES will record events as indicated here:
typedef struct pEvntrec
{
 WORD ap_event;
 LONG ap_value;
} EVNTREC;ap_event defines the required interpretation of ap_value as follows:
Name
ap_event
Eventap_value
APPEVNT_TIMER
0
TimerElapsed Time (in milliseconds)
APPEVNT_BUTTON
1
Buttonlow word = state (1 = down)

high word = # of clicks

APPEVNT_MOUSE
2
Mouselow word = X pos

high word = Y pos

APPEVNT_KEYBOARD
3
Keyboardbits 0-7: ASCII code

bits 8-15: scan code

bits 16-31: shift key state

Binding
intin[0] = num;

addrin[0] = mem;

return crys_if(0x0F);
Return Valueappl_trecord() returns the number of events actually recorded.
CaveatsThis function does not work correctly on AES versions less than 1.40 without a patch program available from Atari Corp.
See Alsoappl_tplay()


appl_write()

WORD appl_write( ap_id, length, msg )

WORD ap_id, length;

VOIDP msg;
appl_write() can be used to send a message to a valid message pipe.
Opcode12 (0x0C)
AvailabilityAll AES versions.
Parametersap_id is the application identifier of the process to which you wish to send the message. length specifies the number of bytes present in the message. msg is a pointer to a memory buffer with at least length bytes available.
Binding
intin[0] = ap_id;
intin[1] = length;

addrin[0] = msg;

return crys_if(0x0C);
Return Valueappl_write() returns 0 if an error occurred or greater than 0 if the message was sent successfully.
Version NotesAs of AES version 1.40, desk accessories may send MN_SELECTED messages to the desktop to trigger desktop functions.

As of AES version 4.00 you can use shel_write(7,...) to 'broadcast' a message to all processes running with the exception of the AES itself, the desktop, and your own application. See shel_write() for details.

CommentsIt is recommended that you always send messages in 16 byte blocks using a WORD array of 8 elements as the AES does.
See Alsoappl_read(), shel_write()

Event Library


The Event Library consists of a group of system calls which are used to monitor system messages including mouse clicks, keyboard usage, menu bar interaction, timer calls, and mouse tracking. The library consists of the following calls:

evnt_button()

evnt_dclick()

evnt_keybd()

evnt_mesag()

evnt_mouse()

evnt_multi()

evnt_timer()

evnt_button()

evnt_button()

WORD evnt_button( clicks, mask, state, mx, my, button, kstate )

WORD clicks, mask, state;

WORD *mx, *my, *button, *kstate;
evnt_button() releases control to the operating system until the specified mouse button event has occurred.
Opcode21 (0x15)
AvailabilityAll AES versions.
Parametersclicks specifies the number of mouse-clicks that must occur before returning. mask specifies the mouse buttons to wait for as follows:
Name
mask
Meaning
LEFT_BUTTON
0x01
Left mouse button
RIGHT_BUTTON
0x02
Right mouse button
MIDDLE_BUTTON
0x04
Middle button (this button would be the first button to the left of the rightmost button on the device).
-
0x08

.

.
Other buttons (0x08 is the mask for the button to the immediate left of the middle button. Masks continue leftwards).
state specifies the button state that must occur before returning as follows:
mask
Meaning
0x00
All buttons released
0x01
Left button depressed
0x02
Right button depressed
0x04
MIddle button depressed
0x08

.

.
etc...
mx is a pointer to a WORD which upon return will contain the x-position of the mouse pointer at the time of the event. my is a pointer to a WORD which upon return will contain the y-position of the mouse pointer at the time of the event.

button is a pointer to a WORD which upon return will contain the mouse button state as defined in state.

kstate is a pointer to a WORD which upon return will contain the current status of the keyboard shift keys. The value is a bit-mask defined as follows:

Name
Mask
Key
K_RSHIFT
0x01
Right Shift
K_LSHIFT
0x02
Left Shift
K_CTRL
0x04
Control
K_ALT
0x08
Alternate
Binding
intin[0] = clicks;
intin[1] = mask;
intin[2] = state;

crys_if(0x15);

*mx = intout[1];
*my = intout[2];
*button = intout[3];
*kstate = intout[4];

return intout[0];
Return ValueUpon exit, evnt_button() returns a WORD indicating the number of times the mouse button state matched state.
CommentsA previously undocumented feature of this call is accessed by logically OR'ing the mask parameter with 0x100. This causes the call to return when independent buttons are depressed. For example, a mask value of 0x03 will return when both the left and right mouse buttons are depressed. A mask value of 0x103 will cause the call to return when either button is depressed.
See Alsoevnt_multi()


evnt_dclick()

WORD evnt_dclick( new, flag )

WORD new, flag;
evnt_dclick() sets the mouse double-click response rate. This call is global, and thus, affects all applications.
Opcode26 (0x1A)
AvailabilityAll AES versions.
ParametersIf flag is EDC_INQUIRE (0), new is ignored and the current double-click rate is returned. If flag is EDC_SET (1), new specifies the new double-click rate as follows:
flag
Response
0

1

2

3

4
Slowest

Fastest

Binding
intin[0] = new;
intin[1] = flag;

return crys_if(0x1A);
Return Valueevnt_dclick() returns the newly set or current double-click rate based on flag.
CommentsBecause this setting is global for all applications, Atari has strongly recommended that developers use this call only where appropriate (such as in a configuration CPX like the General Setup CPX included with XCONTROL).


evnt_keybd()

WORD evnt_keybd( VOID )
evnt_keybd() relinquishes program control to the operating system until a valid keypress is available in the applications' message pipe.
Opcode20 (0x14)
AvailabilityAll AES versions.
ParametersNone
Binding
return crys_if(0x14);
Return Valueevnt_keybd() returns a 16-bit value containing the ASCII code of the key entered in the lower eight bits and the scan code in the upper 8-bits.
Version NotesTOS versions released at or above 2.06 and 3.06 disabled reception of keys 1 through 9 on the numeric keypad when used in conjunction with the alternate key. Users may now enter the full range of ASCII values by holding down alt, typing in the decimal ASCII code, and then releasing the alt key. These keys, therefore, should not be used by applications. The standard numeric keypad is still available.
See Alsoevnt_multi()


evnt_mesag()

WORD evnt_mesag( msg )

WORD *msg;
evnt_mesag() releases control to the operating system until a valid system message is available in the applications' message pipe.
Opcode23 (0x17)
AvailabilityAll AES versions.
Parametersmsg is a pointer to an array of 8 WORD's to be used as a message buffer.
Binding
addrin[0] = msg

return crys_if(0x17);
Return ValueThe return value is currently reserved by Atari and currently is defined as 1. The array msg is filed in with the following values:
Index Description Possible Values #
msg[0]Message Type MN_SELECTED

WM_REDRAW

WM_TOPPED

WM_CLOSED

WM_FULLED

WM_ARROWED

WM_HSLID

WM_VSLID

WM_SIZED

WM_MOVED

WM_UNTOPPED

WM_ONTOP

WM_BOTTOM

WM_ICONIFY

WM_UNICONIFY

WM_ALLICONIFY

WM_TOOLBAR

AC_OPEN

AC_CLOSE

AP_TERM

AP_TFAIL

AP_RESCHG

SHUT_COMPLETED

RESCH_COMPLETED

AP_DRAGDROP

SH_WDRAW

CH_EXIT

10

20

21

22

23

24

25

26

27

28

30

31

33

34

35

36

37

40

41

50

51

57

60

61

63

72

90

msg[1]The application identifier of the sending application. Any valid ap_id.
msg[2]The length of the message beyond 16 bytes (use appl_read() to read the excess). Currently all system messages return 0 in this slot. Only user-defined messages utilize a higher value.
Each system message can be interpreted as follows:
Message Extended Information
MN_SELECTEDA menu item has been selected by the user. msg[3] contains the object number of the menu title and msg[4] contains the object number of the menu item.

As of AES version 3.30 (and when indicated by appl_getinfo() ), msg[5] and msg[6] contain the high and low word, respectively, of the object tree of the menu item. msg[7] contains the parent object index of the menu item.

WM_REDRAWThis message alerts an application that a portion of the screen needs to be redrawn. msg[3] contains the handle of the window to redraw. msg[4-7] are the x, y, w, and h respectively of the 'dirtied' area.

When the message is received the window contents should be drawn (or a representative icon if the window is iconified).

WM_TOPPEDThis message is sent when an application window which is currently not the top window is clicked on by the user. msg[3] contains the handle of the window.

You should use wind_set( msg[3], WF_TOP, 0, 0, 0, 0) to actually cause the window to be topped.

WM_CLOSEDThis message is sent when the user clicks on a windows' close box. msg[3] contains the handle of the window to close.

You should react to this message with wind_close().

WM_FULLEDThis message is sent when the user clicks on a windows' full box. If the window is not at full size, the window should be resized using wind_set(handle, WF_CURRXYWH,... to occupy the entire screen minus the menu bar (see wind_get()).

If the window was previously 'fulled' and has not been resized since, the application should return the window to its previous size.

WM_ARROWEDThis message is sent to inform an application that one of its slider gadgets has been clicked on.

A row or column message is sent when a slider arrow is selected. A 'page' message is sent when a darkened area of the scroll bar is clicked. This usually indicates that the application should adjust the window's contents by a larger amount than with the row or column messages.

msg[3] indicates which action was actually selected as follows: Name Value Meaning

WA_UPPAGE 0 Page Up

WA_DNPAGE 1 Page Down

WA_UPLINE 2 Row Up

WA_DNLINE 3 Row Down

WA_LFPAGE 4 Page Left

WA_RTPAGE 5 Page Right

WA_LFLINE 6 Column Left

WA_RTLINE 7 Column Right

WM_HSLIDThis message indicates that the horizontal slider has been moved. msg[3] contains the new slider position ranging from 0 to 1000.

Note: Slider position is relative and not related to slider size.

WM_VSLIDThis message indicates that the vertical slider has been moved. msg[3] contains the new slider position ranging from 0 to 1000.

Note: Slider position is relative and not related to slider size.

WM_SIZEDThis message occurs when the user drags the window sizing gadget. msg[3] contains the window handle. msg[4-7] indicate the x, y, w, and h respectively of the new window location.

Use wind_set(handle, WF_CURRXYWH,... to actually size the window.

WM_SIZED and WM_MOVED usually share common handling code.

WM_MOVEDThis message occurs when the user moves the window by dragging the windows' title bar. msg[3] contains the handle of the window being moved. msg[4-7] indicate the x, y, w, and h respectively of the new window location.

Use wind_set(handle, WF_CURRXYWH,... ) to actually move the window.

WM_MOVED and WM_SIZED usually share common handling code.

WM_UNTOPPEDThis message is sent when the current window is sent behind one or more windows as the result of another window being topped. msg[3] contains the handle of the window being untopped.

The application need take no action. The message is for informational use only.

WM_ONTOPThis message is sent when an applications' window is brought to the front on a multitasking AES. msg[3] is the handle of the window being brought to the front.

This message requires no action, it is for informational purposes only.

WM_BOTTOMEDThis message is sent when the user shift-clicks on the window's (specified in msg[3]) mover bar to indicate that the window should be sent to the bottom of the window stack by using wind_set() with a parameter of WF_BOTTOM.
WM_ICONIFYThis message is sent when the user clicks on the SMALLER window gadget. msg[3] indicates the handle of the window to be iconified. msg[4-7] indicate the x, y, w, and h of the iconified window.

If the iconified window represents a single window this message should be responded to by using wind_set() with a parameter of WF_ICONIFY.

WM_UNICONIFYThis message is sent when the user double-clicks on an iconified window. msg[3] indicates the handle of the window to be iconified. msg[4-7] indicate the x, y, w, and h of the original window.

This message should be responded to by using wind_set() with a parameter of WF_UNICONIFY.

WM_ALLICONIFYThis message is sent when the user ctrl-clicks on the SMALLER window gadget. msg[3] indicates which window's gadget was clicked. msg[4-7] indicates the position at which the new iconified window should be placed.

The application should respond to this message by closing all open windows and opening a new iconified window at the position indicated which represents the application.

WM_TOOLBARThis message is sent when a toolbar object is clicked. msg[3] contains the handle of the window containing the toolbar.

msg[4] contains the object index of the object clicked. msg[5] contains the number of clicks. msg[6] contains the state of the keyboard shift keys at the time of the click (as in evnt_keybd() ).

AC_OPENThis message is sent when the user has selected a desk accessory to open. msg[4] contains the application identifier (as returned by appl_init()) of the accessory to open.
AC_CLOSEThis message is sent to a desk accessory when the accessory should be closed. msg[3] is the application identifier (as returned by appl_init()) of the accessory to close.

Do not close any windows your accessory had open, the system will do this for you. Also, do not require any feedback from the user when this is received. Treat this message as a 'Cancel' from the user.

AP_TERMThis message is sent when the system requests that the application terminate. This is usually the result of a resolution change but may also occur if another application sends this message to gain total control of the system.

The application should shut down immediately after closing windows, freeing resources, etc... msg[5] indicates the reason for the shut down as follows: AP_TERM (50) = Just shut down.

AP_RESCHG (57) = Resolution Change.If for some reason, your process can not shut down you must inform the AES by sending an AP_TFAIL (51) message by using shel_write() mode 10 (see shel_write()).

Note: Desk Accessories wil always be sent AC_CLOSE messages, not AP_TERM.

AP_TFAILThis message should be sent to the system (see shel_write()) when an application has received an AP_TERM (50) message and cannot shut down.

msg[0] should contain AP_TFAIL and msg[1] should contain the application error code.

AP_RESCHGThis message is actually a sub-command and is only found as a possible value in the AP_TERM (50) message (see above).
SHUT_COMPLETEDThis message is sent to the application which requested a shutdown when the shutdown is complete and was successful.
RESCH_COMPLETEDThis message is sent to an application when a resolution change it requested is completed. msg[3] contains 1 if the resolution change was successful and 0 if an error occurred.
AP_DRAGDROPThis message indicates that another application wishes to initiate a drap and drop session. msg[3] indicates the handle of the window which had an object dropped on it or -1 if no specific window was targeted.

msg[4-5] contains the X and Y position of the mouse when the object was 'dropped'. msg[6] indicates the keyboard shift state at the time of the drop (as in evnt_keybd() ).

msg[7] is a two-byte ASCII packed pipe identifier which gives the file extension of the pipe to open.

For more information about the drag & drop protocal, see Chapter 2: GEMDOS.

SH_WDRAWThis message is sent to the Desktop to ask it to update an open drive window. msg[3] should contain the drive number to update (0 = A:, 1 = B:) or -1 to update all windows.
CH_EXITThis message is sent when a child process that the application has started, returns. msg[3] contains the child's application identifier and msg[4] contains its exit code.
Version NotesWM_UNTOPPED, WM_ONTOP, AP_TERM, AP_TFAIL, AP_RESCHG, SHUT_COMPLETED, RESCH_COMPLETED, and CH_EXIT are new as of AES version 4.0.

WM_BOTTOM, WM_ICONIFY, WM_UNICONIFY, WM_ALLICONIFY, and WM_TOOLBAR are new as of AES version 4.1.

No lower version AES will send these messages.

The existence (or acceptance) of these messages should also be checked for by using appl_getinfo().

See Alsoevnt_multi()


evnt_mouse()

WORD evnt_mouse( flag, x, y, w, h, mx, my, button, kstate )

WORD flag, x, y, w, h;

WORD *mx, *mx, *button, *kstate;
evnt_mouse() releases control to the operating system until the mouse enters or leaves a specified area of the screen .
Opcode22 (0x16)
AvailabilityAll AES versions.
Parametersflag specifies the event to wait for as follows:
Name
Value
Meaning
MO_ENTER
0
Wait for mouse to enter rectangle.
MO_LEAVE
1
Wait for mouse to leave rectangle.
The rectangle to watch is specified in x, y, w, h. mx and my are WORD pointers which will be filled in with the final position of the mouse.

button is a WORD pointer which will be filled in upon return with the final state of the mouse button as defined in evnt_button().

kstate is a WORD pointer which will be filled in upon return with the final state of the keyboard shift keys as defined in evnt_button().

Binding
intin[0] = flag;
intin[1] = x;
intin[2] = y;
intin[3] = w;
intin[4] = h;

crys_if(0x16);

*mx = intout[1];
*my = intout[2];
*button = intout[3];
*kstate = intout[4];

return intout[0];
Return ValueThe return value of this function is reserved. Currently it always returns 1.
CommentsThe evnt_multi() function can be used to watch two mouse/rectangle events as opposed to one.
See Alsoevnt_multi()


evnt_multi()

WORD evnt_multi( events, bclicks, bmask, bstate, m1flag, m1x, m1y, m1w, m1h, m2flag, m2x, m2y, m2w, m2h, msg, locount, hicount, mx, my,mb, ks, kc, mc )

WORD events, bclicks, bmask, bstate, m1flag, m1x, m1y, m1w, m1h, m2flag, m2x, m2y, m2w, m2h;

WORD *msg;

WORD locount, hicount;

WORD *mx, *my, *ks, *kc, *mc;
evnt_multi() suspends the application until a valid message that the application is interested in occurs. This call combines the functionality of evnt_button(), evnt_keybd(), evnt_mesag(), evnt_mouse(), and evnt_timer() into one call.

This call is usually the cornerstone of all GEM applications that must process system events.

Opcode25 (0x19)
AvailabilityAll AES versions.
Parametersevents is a bit mask which tells the function which events your application is interested in. You should logically 'OR' any of the following values together:
Name
Mask
Function
MU_KEYBD
0x01
Wait for a user keypress.
MU_BUTTON
0x02
Wait for the specified mouse button state.
MU_M1
0x04
Wait for a mouse/rectangle event as specified.
MU_M2
0x08
Wait for a mouse/rectangle event as specified.
MU_MESAG
0x10
Wait for a message.
MU_TIMER
0x20
Wait the specified amount of time.
For usage of bclicks, bmask, bstate, mx, my, kc, and ks, you should consult evnt_button().

For usage of m1flag, m1x, m1y, m1w, m1h, m2flag, m2x, m2y, m2w, and m2h, consult evnt_mouse().

For usage of msg, see evnt_mesag().

For usage of locount and hicount, see evnt_timer().

Binding
intin[0] = events;
intin[1] = bclicks;
intin[2] = bmask;
intin[3] = bstate;
intin[4] = m1flag;
intin[5] = m1x;
intin[6] = m1y;
intin[7] = m1w;
intin[8] = m1h;
intin[9] = m2flag;
intin[10] = m2x;
intin[11] = m2y;
intin[12] = m2w;
intin[13] = m2h;
intin[14] = locount;
intin[15] = hicount;

addrin[0] = msg;

crys_if(0x19);

*mx = intout[1];
*my = intout[2];
*mb = intout[3];
*ks = intout[4];
*kc = intout[5];
*mc = intout[6];

return intout[0];
Return ValueThe function returns a bit mask of which events actually happened as in events. This may be one or more events and your application should be prepared to handle each.
Version NotesThe only facet of evnt_multi() which has changed from AES version 4.0 is that which relates to evnt_mesag(). For further information you should consult that section.
CaveatsUnder TOS 1.0, calling this function from a desk accessory with the MU_TIMER mask and locount and hicount being equal to 0 could hang the system.
See Alsoevnt_button(), evnt_keybd(), evnt_mesag(), evnt_mouse(), evnt_timer()


evnt_timer()

WORD evnt_timer( locount, hicount )

WORD locount, hicount;
evnt_timer() releases control to the operating system until a specified amount of time has passed.
Opcode24 (0x18)
AvailabilityAll AES versions.
Parameterslocount is the low word of a 32-bit time value specified in milliseconds.

hicount is the high portion of that 32-bit value.

Binding
intin[0] = locount;
intin[1] = hicount;

return crys_if(0x18);
Return ValueThe return value is reserved and is currently always 1.
CaveatsUnder TOS 1.0, calling this function from a desk accessory with a both parameters having a value of 0 will hang the system.
CommentsThis function should not be relyed on as an accurate clock. The time specified is used as a minimum time value only and the function will return at some point after that duration has passed.
See Alsoevnt_multi()

Form Library


The Form Library contains utility functions for the use and control of dialog boxes, alert boxes, and user input. The members of the Form Library are:

form_alert()

form_button()

form_center()

form_dial()

form_do()

form_error()

form_keybd()

form_alert()

WORD form_alert( default, alertstr )

WORD default;

CHAR *alertstr;
form_alert() displays a standardized alert box and returns the user's selection.
Opcode52 (0x34)
AvailabilityAll AES versions.
Parametersdefault contains the number of the exit button which is to be made default (1-3). alertstr contains a formatted string as follows: "[#][Alert Text][Buttons]".

# specifies the icon to display in the alert as follows:


#
Icon Displayed
0
No Icon
1
2
3
4
5
'Alert Text' is a text string of as many as 5 lines composed of up to 30 characters each. Each line is separated by a '|' character.

'Buttons' is a text string to define as many as 3 buttons up to 10 characters each. If only one button is used, its text may be as long as 30 characters. Again, each button is separated by a '|' character

Binding
intin[0] = default;

addrin[0] = alertstr;

return crys_if(0x34);
Return Valueform_alert() returns a WORD indicating which button was used to exit by the user (A possible value of 1-3).
Version NotesIcons #4-5 are only available as of AES version 4.1.
CaveatsSeveral versions of the AES have special quirks related to this function. By following the quidelines below you should avoid any difficulty:1. All AES versions below 1.06 have some difficulty formatting alert strings padded with spaces. If you want your alerts to look right on all AES versions, do not pad any button or line with spaces with the exception below.

2. Add one space to the end of the longest text line on an alert. This will prevent the right edge from touching the border in some AES versions.


form_button()

WORD form_button( tree, obj, clicks, newobj )

OBJECT *tree;

WORD obj, clicks, newobj;
form_button() is a utility function designed to aid in the creation of a custom form_do() handler.
Opcode56 (0x38)
AvailabilityAll AES versions.
Parameterstree is a pointer to a valid object tree in memory you wish to process button events for. obj is the object index into tree which was clicked on and which needs to be processed.

clicks is the number of times the mouse button was clicked.

newobj returns the next object to gain edit focus or 0 if there are no editable objects. If the top bit of newobj is set, this indicates that a TOUCHEXIT object was double-clicked.

Binding
intin[0] = obj;
intin[1] = clicks;

addrin[0] = tree;

crys_if(0x38);

*newobj = intout[1];

return intout[0];
Return Valueform_button() returns a 0 if it exits finding an EXIT or TOUCHEXIT object selected or 1 otherwise.
CommentsTo use this function properly, the application should take the following steps:1. Monitor mouse clicks with evnt_multi() or evnt_button().

2. When a click occurs, use objc_find() to determine if the click occurred over the object.

3. If so, call form_button() with the appropriate values.This function was not originally documented by Atari. You may have to add bindings for this function to some earlier 'C' compilers.

See Alsoform_do(), form_keybd()


form_center()

WORD form_center( tree, x, y, w, h )

OBJECT *tree;

WORD *x, *y, *w, *h;
form_center() is used to modify an object's coordinates so that it will appear in the center of the display screen.
Opcode54 (0x36)
AvailabilityAll AES versions.
Parameterstree points to a valid OBJECT structure (see discussion of resources) which the application wishes to have centered. x, y, w, and h, return a clipping rectangle suitable for use in objc_draw().
Binding
addrin[0] = tree;

crys_if(0x36);

*x = intout[1];
*y = intout[2];
*w = intout[3];
*h = intout[4];

return intout[0];
Return ValueThe return value is currently reserved. Currently it equals 1.
CommentsThe values that form_center() returns in x, y, w, and h, are not necessarily the same as the object's. These values take into account negative borders, outlining, and shadowing. This is meant to provide a suitable clipping rectangle for objc_draw()
See Alsoobjc_draw()


form_dial()

WORD form_dial( mode, x1, y1, w1, h1, x2, y2, w2, h2 )

WORD mode, x1, y1, w1, h1, x2, y2, w2, h2;
form_dial() is used to reserve and release screen space for dialog usage. In addition, it also optionally provides grow/shrink box effects.
Opcode51 (0x33)
AvailabilityAll AES versions.
Parametersmode specifies the action to take and the meaning of remaining parameters as follows:
Name
#
Action
FMD_START
0
This mode reserves the screen space for a dialog. x2, y2, w2, and h2, contain the coordinates of the dialog to be used (usually obtained through form_center()).
FMD_GROW
1
This mode draws an expanding box from the coordinates specified in x1, y1, w1, and h1 to the coordinates specified in x2, y2, w2, and h2. This call is optional and is not required to display a dialog.
FMD_SHRINK
2
This mode draws a shrinking box from the coordinates specified in x2, y2, w2, and h2 to the coordinates specified in x1, y1, w1, and h1. This call is optional and is not required to display a dialog.
FMD_FINISH
3
This mode releases the screen space for a dialog (previously reserved with mode 0). x2, y2, w2, and h2 contain the coordinates of the space to release. One of the side-effects of this call is a WM_REDRAW message sent to any window which the dialog was covering.
Binding
intin[0] = mode;
intin[1] = x1;
intin[2] = y1;
intin[3] = w1;
intin[4] = h1;
intin[5] = x2;
intin[6] = y2;
intin[7] = w2;
intin[8] = h2;

return crys_if(0x33);
Return ValueThe function returns 0 is an error occurred or non-zero otherwise.
Version NotesThe AES does not currently make use of mode FMD_START. The call should, however, still be executed for upward compatibility.
See Alsograf_growbox(), graf_shrinkbox()


form_do()

WORD form_do( tree, editobj )

OBJECT *tree;

WORD editobj;
form_do() provides an automated dialog handling function to the calling application. It suspends program control, handling all radio buttons, selectable objects, etc... until an object with the TOUCHEXIT or EXIT flag is selected.
Opcode50 (0x32)
AvailabilityAll AES versions.
Parameterstree is a pointer to a valid object tree (see the discussion on objects in this chapter) which contains a dialog with at least one EXIT or TOUCHEXIT button or object.

editobj is the object index into tree which specifies the desired initial location of the edit cursor (the object must be flagged as EDITABLE). If the form has no text editable fields, you should use 0.

Binding
intin[0] = editobj;

addrin[0] = tree;

return crys_if(0x32);
Return Valueform_do() returns the object index of the EXIT or TOUCHEXIT button which was selected. If the object was double clicked, bit 15 will be set. This means that to obtain the actual object number you should mask off the result with 0x7FFF.


form_error()

WORD form_error( error )

WORD error;
form_error() displays a pre-defined error alert box to the user.
Opcode53 (0x35)
AvailabilityAll AES versions.
Parameterserror specifies a MS-DOS error code as follows:
Name
GEMDOS Error #
error
Message
FERR_FILENOTFOUND
-33
2
File Not Found

The application can not find the folder or file that you tried to access.

FERR_PATHNOTFOUND
-34
3
Path Not Found

The application cannot find the folder or file that you tried to access.

FERR_NOHANDLES
-35
4
No More File Handles

The application does not have room to open another document. To make room, close any open document that you do not need.

FERR_ACCESSDENIED
-36
5
Access Denied

An item with this name already exists in the directory, or this item is set to read-only status.

FERR_LOWMEM
-39
8
Insufficient Memory

There is not enough memory for the application you just tried to run.

FERR_BADENVIRON
-41
10
Invalid Environment

There is not enough memory for the application you just tried to run.

FERR_BADFORMAT
-42
11
Invalid Format

There is not enough memory for the application you just tried to run.

FERR_BADDRIVE
-46
15
Invalid Drive Specification

The drive you specified does not exist.

FERR_DELETEDIR
-47
16
Attempt To Delete Working Directory

You cannot delete the folder in which you are working.

FERR_NOFILES
-49
18
No More Files

The application can not find the folder or file that you tried to access.

The GEMDOS error number can be translated into a MS-DOS code by subtracting 31 from the absolute value of the error code.
Binding
intin[0] = error;

return crys_if(0x35);
Return ValueThe function returns the exit button clicked as in form_alert(). It is, however, insignifigant as all of the error alerts have only one button.
CaveatsNot every GEMDOS error code has a matching alert box.
See Alsoform_alert()


form_keybd()

WORD form_keybd( tree, obj, nextobj, kc, newobj, keyout )

OBJECT *tree;

WORD obj, nextobj, kc;

WORD *newobj, *keyout;
form_keybd() processes keyboard input for dialog box control. It handles special keys such as return, escape, tab, etc... It is only of real use if you are writing a customized form_do() routine.
Opcode55 (0x37)
AvailabilityAll AES versions.
Parameterstree points to a valid OBJECT tree containing the dialog you wish to process. obj is the object index of the object which currently has edit focus (0 if none). nextobj is reserved and should be 1.

kc is the value returned from evnt_keybd() or evnt_multi() which represents the keypresses' scan code and ASCII value.

newobj is a WORD pointer which is filled in on function exit to be the new object with edit focus unless the return key was pressed with a default object present in which case it equals the object index of the object that was the default.

keyout is the value ready to be passed on to objc_edit() if no processing was required or 0 if the key was processed and handled by the call.

Binding
intin[0] = obj;
intin[1] = kc;
intin[2] = nextobj;

addrin[0] = tree;

crys_if(0x37);

*newobj = intout[1];
*keyout = intout[2];

return intout[0];
Return Valueform_keybd() returns 0 if a default EXIT object was triggered by this call or 1 if the dialog should continue to be processed.
CommentsThis function was not originally documented by Atari. You may need to add bindings for this function into some older 'C' compilers.
See Alsoobjc_edit(), form_do(), form_button()

File Selector Library


The File Selector Library contains two functions for displaying the system file selector (or currently installed alternate file selector) and prompting the user to select a file. The members of this library are:

fsel_exinput()

fsel_input()

fsel_exinput()

WORD fsel_exinput( path, file, button, title )

CHAR *path, *file;

WORD *button;

CHAR *title;
fsel_exinput() displays the system file selector and offers the user an opportunity to choose a complete GEMDOS path specification.
Opcode91 (0x5B)
AvailabilityAvailable from AES version 1.40.
Parameterspath should be a pointer to a character buffer at least 128 bytes long (applications wishing to access CD-ROM's should allocate at least 200 bytes). On input the buffer should contain a complete GEMDOS path specification including a drive specifier, path string, and wildcard mask as follows: 'drive:\path\mask'. The mask can be any valid GEMDOS wildcard (usually *.*).

On function exit, path contains final path of the selected file (you will have to strip the mask).

file should point to a character buffer 13 bytes long (12 character filename plus NULL). On input its contents will be placed on the filename line of the selector (usually this value can simply be a empty string). On function exit, file contains the filename which the user selected.

button is a short pointer which upon function exit will contain FSEL_CANCEL (0) if the user selected CANCEL or FSEL_OK (1) if OK.

title should be a pointer to a character string up to 30 characters long which contains the title to appear in the file selector (usually indicates which action the user is about to take).

Binding
addrin[0] = path;
addrin[1] = file;
addrin[2] = label;

crys_if(0x5B);

*button = intout[1];

return intout[0];
Return Valuefsel_exinput() returns 0 if an error occured and 1 otherwise.
Version NotesSome 'C' compilers (Lattice for example) provide a special function which allows fsel_exinput() to be used even on earlier AES versions.
CommentsThe path parameter to this function should be validated to ensure that the path actually exists prior to calling this function to prevent confusing the user.

This call should always be used as opposed to fsel_input() when it is available. Otherwise, the user has no reminder as to what function s/he is actually undertaking.

See Alsofsel_input()


fsel_input()

WORD fsel_input( path, file, button )

CHAR *path, *file;

WORD *button;
fsel_input() displays the system file selector and allows the user to select a valid GEMDOS path and file.
Opcode90 (0x5A)
AvailabilityAll AES versions.
ParametersAll parameters are consistent with fsel_exinput() with the notable lack of title.
Binding
addrin[0] = path;
addrin[1] = file;

crys_if(0x5A);

*button = intout[1];

return intout[0];
Return Valuefsel_input() returns a 0 if an error occurred or 1 otherwise.
CommentsYou should never use this function in place of fsel_exinput() when fsel_exinput() is available.
See Alsofsel_exinput()

Graphics Library


The Graphics Library provides applications with a variety of utility functions which serve to provide common screen effects, mouse control, and the obtaining of basic screen attributes. The functions of the Graphics Library are as follows:

graf_dragbox()

graf_growbox()

graf_handle()

graf_mkstate()

graf_mouse()

graf_movebox()

graf_rubberbox()

graf_shrinkbox()

graf_slidebox()

graf_watchbox()

graf_dragbox()

WORD graf_dragbox( w, h, sx, sy, bx, by, bw, bh, endx, endy )

WORD w, h, sx, sy, bx, by, bw, bh;

WORD *endx, *endy;
graf_dragbox() allows the user to move a box frame within the constraints of a bounding rectangle. This call is most often used to give the user a visual 'clue' when an object is being moved on screen.
Opcode71 (0x47)
AvailabilityAll AES versions.
Parametersw and h specify the initial width and height of the box to draw. sx and sy specify the starting x and y screen coordinates.

bx, by, bw, and bh, give the coordinates of the bounding rectangle.

endx and endy are WORD pointers which, on function exit, will be filled in with the ending x and y position of the box.

Binding
intin[0] = w;
intin[1] = h;
intin[2] = sx;
intin[3] = sy;
intin[4] = bx;
intin[5] = by;
intin[6] = bw;
intin[7] = bh;

crys_if(0x47);

*endx = intout[1];
*endy = intout[2];

return intout[0];
Return Valuegraf_dragbox() returns a 0 if an error occurred during execution or greater than zero otherwise.
CommentsThis call should be made only when the mouse button is depressed. The call returns when the mouse button is released.
See Alsograf_slidebox()


graf_growbox()

WORD graf_growbox( x1, y1, w1, h1, x2, y2, w2, h2 )

WORD x1, y1, w2, h2, x2, y2, w2, h2;
graf_growbox() is used to provide a visual 'clue' to a user by animating an outline of a box from one set of coordinates to another. It is the complement function to graf_shrinkbox().
Opcode73 (0x49)
AvailabilityAll AES versions.
Parametersx1, y1, w1, and h1 are the screen coordinates of the starting rectangle (where the outline will grow from).

x2, y2, w2, and h2 are the screen coordinates of the ending rectangle (where the outline will grow to).

Binding
intin[0] = x1;
intin[1] = y1;
intin[2] = w1;
intin[3] = h1;
intin[4] = x2;
intin[5] = y2;
intin[6] = w2;
intin[7] = h2;

return crys_if(0x49);
Return Valuegraf_growbox() returns 0 if an error occured or non-zero otherwise.
CaveatsThere is currently no defined method of handling an error generated by this function.
CommentsThis function is what is called by GEM's form_dial(FMD_GROW,...
See Alsoform_dial(), graf_shrinkbox()


graf_handle()

WORD graf_handle( wcell, hcell, wbox, hbox );

WORD *wcell, *hcell, *wbox, *hbox;
graf_handle() returns important information regarding the physical workstation currently in use by the AES.
Opcode77 (0x4D)
AvailabilityAll AES versions.
Parameterswcell and hcell are WORD pointers which on function exit will be filled in with the width and height, respectively, of the current system character set.

wbox and hbox are WORD pointers which on function exit will be filled in with the width and height, respectively, of the minimum bounding box of a BOXCHAR character.

Binding
crys_if(0x4D);

*charw = intout[1];
*charh = intout[2];
*boxw = intout[3];
*boxh = intout[4];

return intout[0];
Return ValueThis function returns the VDI handle for the current physical workstation used by the AES.
CaveatsThere is currently no defined method of handling an error generated by this function.
CommentsThe return value of this function is required to open a virtual screen workstation.
See Alsov_opnvwk()


graf_mkstate()

WORD graf_mkstate( mx, my, mb, ks )

WORD *mx, *my, *mb, *ks;
graf_mkstate() returns information about the current state of the mouse pointer, buttons, and keyboard shift-key state.
Opcode79 (0x4F)
AvailabilityAll AES versions.
Parametersmx and my are WORD pointers, which, on function exit will be filled in with the current x and y coordinates of the mouse pointer. mb is a WORD pointer, which, on function exit will be filled in with the current button state of the mouse as defined in evnt_button().
Binding
crys_if(0x4F);

*mx = intout[1];
*my = intout[2];
*mb = intout[3];
*ks = intout[4];

return intout[0];
Return ValueThe function return is currently reserved and currently equals 1.
See Alsoevnt_button(), vq_mouse()


graf_mouse()

WORD graf_mouse( mode, formptr )

WORD mode;

VOIDP formptr;
graf_mouse() alters the appearance of the mouse form and can be used to hide and display the mouse pointer from the screen.
Opcode78 (0x4E)
AvailabilityAll AES versions.
Parametersmode is defined as follows:
mode
#
Meaning Shape
ARROW
0
Change the current mouse cursor shape.
TEXT_CRSR
1
Change the current mouse cursor shape.
BUSY_BEE
2
Change the current mouse cursor shape.
POINT_HAND
3
Change the current mouse cursor shape.
FLAT_HAND
4
Change the current mouse cursor shape.
THIN_CROSS
5
Change the current mouse cursor shape.
THICK_CROSS
6
Change the current mouse cursor shape.
OUTLN_CROSS
7
Change the current mouse cursor shape.
USER_DEF
255
Change the current mouse cursor shape. Form is defined below.
M_OFF
256
Remove the mouse cursor from the screen. No shape change.
M_ON
257
Display the mouse cursor.No shape change.
M_SAVE
258
Save the current mouse form in an AES provided buffer. Check appl_getinfo() for the presence of this feature. No shape change.
M_LAST
259
Restore the most recently saved mouse form. Check appl_getinfo() for the presence of this feature. Changes the shape as indicated.
M_RESTORE
260
Restore the mouse form to its last shape. Check appl_getinfo() for the presence of this feature. Changes the shape as indicated.
If mode is equal to USER_DEF, formptr must point to a MFORM structure as defined below (if mode is different than USER_DEF, formptr should be NULL):
typedef struct {
 short mf_xhot;
 short mf_yhot;
 short mf_nplanes;
 short mf_fg;
 short mf_bg;
 short mf_mask[16];
 short mf_data[16];
} MFORM;
mf_xhot and mf_yhot are the location of the mouse 'hot-spot'. These values should be in the range 0 to 15 and define what offset into the bitmap is actually the 'point'.

mf_nplanes specifies the number of bit-planes used by the mouse pointer. Currently, the value of 1 is the only legal value.

mf_fg and mf_bg are the mask and data colors of the mouse specified as palette indexes. Usually these values will be 0 and 1 respectively.

mf_mask is an array of 16 WORD's which define the mask portion of the mouse form. mf_data is an array of 16 WORD's which define the data portion of the mouse form.

As of AES 4.0 and beyond, the AES may not allow a mouse form to change to benefit another application. If it is absolutely necessary for the application to display its mouse form, logically OR the mode parameter with M_FORCE (0x8000) and make the call.

This will force the AES to change to your mouse form. It should, however, be done within the scope of a wind_update() sequence.

Binding
intin[0] = mode;

addrin[0] = formptr;

return crys_if(0x4E);
Return Valuegraf_mouse() returns a 0 if an error occurred or non-zero otherwise.
CaveatsThere is currently no defined method of handling an error generated by this function.
See Alsovsc_form()


graf_movebox()

WORD graf_movebox( bw, bh, sx, sy, ex, ey )

WORD bw, bh, sx, sy, ex, ey;
graf_movebox() animates a moving box between two points on the screen. It is used to give the user a visual 'clue' to an action undertaken by the application.
Opcode72 (0x48)
AvailabilityAll AES versions.
Parametersbw and bh specify the width and height, respectively, of the box to animate. sx and sy specify the starting coordinates of the box. ex and ey specify the ending coordinates of the box.
Binding
intin[0] = bw;
intin[1] = bh;
intin[2] = sx;
intin[3] = sy;
intin[4] = ex;
intin[5] = ey;

return crys_if(0x48);
Return ValueThe return value is 0 if an error occured or non-zero otherwise.
CaveatsThere is currently no defined method for handling an error generated by this call.
CommentsSome older 'C' bindings referred to this call as graf_mbox(). If your compiler still uses this call you should update it.


graf_rubberbox()

WORD graf_rubberbox( bx, by, minw, minh, endw, endh )

WORD bx, by, minw, minh;

WORD *endw, *endh;
graf_rubberbox() allows the user to change the size of a box outline with a fixed starting point.
Opcode70 (0x46)
AvailabilityAll AES versions.
Parametersbx and by define the fixed upper-left corner of the box to stretch or shrink.

minw and minh specify the minimum width and height that the rectangle can be shrunk to.

endw and endh are WORD pointers which will be filled in with the ending width and height of the box when the mouse button is released.

Binding
intin[0] = bx;
intin[1] = by;
intin[2] = minw;
intin[3] = minh;

crys_if(0x46);

*endw = intout[1];
*endh = intout[2];

return intout[0];
Return Valuegraf_rubberbox() returns 0 if an error occurred or non-zero otherwise.
CaveatsThere is currently no defined method for handling an error generated by this call.
CommentsThis function should only be entered when the user has depressed the mouse button as it returns when the mouse button is released.
See Alsograf_dragbox(), graf_slidebox()


graf_shrinkbox()

WORD graf_shrinkbox( x1, y1, w1, h1, x2, y2, w2, h2 )

WORD x1, y1, w1, h1, x2, y2, w2, h2;
graf_shrinkbox() displays an animated box shrinking from one rectangle to another. It should be used to provide the user with a visual 'clue' to an action. It is the complement function to graf_growbox().
Opcode74 (0x4A)
AvailabilityAll AES versions.
Parametersx1, y1, w1, and h1 are the coordinates of the rectangle to shrink to.

x2, y2, w2, and h2 are the coordinates of the rectangle to shrink from.

Binding
intin[0] = x1;
intin[1] = y1;
intin[2] = w1;
intin[3] = h1;
intin[4] = x2;
intin[5] = y2;
intin[6] = w2;
intin[7] = h2;

return crys_if(0x4A);
Return ValueThe function returns 0 if an error occurred or non-zero otherwise
CaveatsThere is currently no defined method of handling an error from this call.
CommentsThis function is essentially the same as form_dial(FMD_SHRINK,...
See Alsoform_dial(), graf_growbox()


graf_slidebox()

WORD graf_slidebox( tree, parent, obj, orient )

OBJECT *tree;

WORD parent, obj,orient;
graf_slidebox() allows the user to slide a child object within the bounds of its parent. It is often used to implement slider controls.
Opcode76 (0x4C)
AvailabilityAll AES versions.
Parameterstree is pointer to the object tree containing the child and parent objects.

parent is the object index of an object which bounds the movement of the child. child is the object index of the object which can be moved within the bounds of parent.

orient specifies the orientation of the allowed movement. 0 is horizontal (left-right), 1 is vertical (up-down).

Binding
intin[0] = parent;
intin[1] = child;
intin[2] = orient;

addrin[0] = tree;

return crys_if(0x4C);
Return ValueThe function returns a value specifying the relative offset of the child within the parent as a number between 0 and 1000.
CommentsThis call can be used easily with sliders built into dialogs by making the slider bar a TOUCHEXIT and calling this function when it is clicked. This call should only be made when the mouse button is depressed as it returns when it is released.
See Alsograf_movebox()


graf_watchbox()

WORD graf_watchbox( tree, obj, instate, outstate )

OBJECT *tree;

WORD obj, instate, outstate;
graf_watchbox() modifies the given state of a specified object depending on whether the pointer is within the bounds of the object or outside the bounds of the object as long as the left mouse button is held down.
Opcode75 (0x4B)
AvailabilityAll AES versions.
Parameterstree is a pointer to the ROOT object of the tree which contains the object you wish to watch. obj is the object index of the object to watch.

instate is the ob_state (see objc_change()) to apply while the mouse is inside of the bounds of the object.

outstate is the ob_state to apply while the mouse is outside of the bounds of the object.

Binding
intin[0] = 0;
intin[1] = obj;
intin[2] = instate;
intin[3] = outstate;

addrin[0] = tree;

return crys_if(0x4B);
Return Valuegraf_watchbox() returns a 0 if the mouse button was released outside of the object or a 1 if the button was released inside of the object.
CommentsAs this call returns when the mouse button is released, it should only be made when the mouse button is depressed. This call is used internally by form_button() and form_do() and is usually only necessary if you are replacing one of these handlers.
See Alsoform_button()

Menu Library


The Menu Library assists in the handling of system menu bars and popup menus. In addition, individual control of menu items can also be handled through these functions. The members of the Menu Library are:

menu_attach()

menu_bar()

menu_icheck()

menu_ienable()

menu_istart

menu_popup()

menu_register()

menu_settings()

menu_text()

menu_tnormal()

menu_attach()

WORD menu_attach( flag, tree, item, mdata )

WORD flag;

OBJECT *tree;

WORD item;

MENU *mdata;
menu_attach() allows an application to attach, change, or remove a sub-menu. It also allows the application to inquire information regarding a currently defined sub-menu.
Opcode37 (0x25)
AvailabilityThis function is only available from AES version 3.30 and above. In AES versions 4.0 and greater, appl_getinfo() should be used to determine its exact functionality.
Parametersflag indicates the action the application desires as follows:
#
Define Meaning
0
ME_INQUIRE Return information on a sub-menu attached to the menu item designated by tree and item in mdata.
1
ME_ATTACH Attach or change a sub-menu. mdata should be initialized by the application.

tree and item should be the OBJECT pointer and index to the menu which is to have the sub-menu attached. If mdata is NULLPTR, any sub-menu attached will be removed.

2
ME_REMOVE Remove a sub-menu. tree and item should be the OBJECT pointer and index to the menu item which a sub-menu was attached to. mdata should be NULLPTR.
In all cases except ME_REMOVE, mdata should point to a MENU structure as defined here:
typedef struct
{
 OBJECT *mn_tree;
 WORD  mn_menu;
 WORD  mn_item;
 WORD  mn_scroll;
 WORD  mn_keystate;
} MENU;
The MENU structure members are defined as follows:
Member Meaning
mn_treePoints to the OBJECT tree of the sub-menu.
mn_menuIs an index to the parent object of the menu items.
mn_itemIs the starting menu item.
mn_scrollIf SCROLL_NO (0), the menu will not scroll. If SCROLL_YES (1), and the number of menu items exceed the menu scroll height, arrows will appear which allow the user to scroll selections.
mn_keystateThis member is unused and should be 0 for this call.
Binding
intin[0] = flag;
intin[1] = item;

addrin[0] = tree;
addrin[1] = mdata;

return crys_if(0x25);
Return Valuemenu_attach() returns 0 if an error occurred and the sub-menu could not be attached or 1 if the operation was successful.
CaveatsAES versions supporting menu_attach() less than 4.1 contain a bug which causes the AES to crash when changing or removing a sub-menu attachment.

At present, if you wish to attach a scrolling menu, the menu items must be G_STRING's.

CommentsIf a menu bar having attachments is removed with menu_bar( NULL, MENU_REMOVE ) those attachments are removed by the system and must be reattached with this call if the menu is redisplayed at a later time.

Several recommendations regarding sub-menus should be adhered to:1. Menu items which will have sub-menus attached to them should be padded with blanks to the end of the menu.

2. Menu items which will have sub-menus attached to them should not have a keyboard equivalent.

3. Sub-menus will display faster if a byte-boundary is specified.

4. Sub-menus will be shifted vertically to align the start object with the main menu item which it is attached to.

5. Sub-menus will always be adjusted to automatically fit on the screen.

6. There can be a maximum of 64 sub-menu attachments per process (attaching a sub-menu to more than one menu item counts as only one attachment).

7. Do not attach a sub-menu to itself.

8. As a user-interface guideline, there should only be one level of sub-menus, though it is possible to have up to four levels currently.

9. menu_istart() works only on sub-menus attached with menu_attach().

See Alsomenu_istart(), menu_settings(), menu_popup()


menu_bar()

WORD menu_bar( tree, mode )

OBJECT *tree;

WORD mode;
menu_bar() displays a specialized OBJECT tree on the screen as the application menu. It can also be used to determine the owner of the currently displayed menu bar in a multitasking AES.
Opcode30 (0x1E)
AvailabilityAll AES versions.
Parameterstree is a pointer to an OBJECT tree which has been formatted for use as a system menu (for more information on the OBJECT format of a menu see the discussion on objects in this chapter).

mode is a flag indicating the action to take as follows:

Name
mode
Meaning
MENU_REMOVE
0
Erase the menu bar specified in tree.
MENU_INSTALL
1
Display the menu bar specified in tree.
MENU_INQUIRE
-1
Return the AES application identifier of the process which owns the currently displayed system menu. tree can be set to NULL. The AES version must be greater than 4.0 and appl_getinfo() must indicate that this is feature is supported.
Binding
intin[0] = mode;

addrin[0] = tree;

return crys_if(0x1E);
Return ValueIf mode is MENU_REMOVE (0) or MENU_INSTALL (1), the return value indicates an error condition where >0 means no error and 0 means an error occurred. In inquiry mode (mode = MENU_INQUIRE (-1)), menu_bar() returns the application identified of the process which owns the currently displayed menu bar.
CommentsThe safest way to redraw an application's menu bar is to redraw it only if you are sure it is currently the active menu bar. In a non-multitasking AES, this is a certainty, however, in a multitasking AES you should first inquire the menu bar's owner within the scope of a wind_update( BEG_UPDATE ) call to prevent the system from swapping active menu bars while in the process of redrawing.
See Alsomenu_ienable(), menu_icheck()


menu_icheck()

WORD menu_icheck( tree, obj, check )

OBJECT *tree;

WORD obj, check;
menu_icheck() adds/removes a checkmark in front of a menu item.
Opcode31 (0x1F)
AvailabilityAll AES versions.
Parameterstree specifies the object tree of the current menu. obj should be the object index of a menu item. If check is UNCHECK (0), no checkmark will be displayed next to this item whereas if check is CHECK (1), a checkmark will be displayed.
Binding
intin[0] = obj;
intin[1] = check;

addrin[0] = obj;

return crys_if(0x1F);
Return Valuemenu_icheck() returns 0 if an error occurred or non-zero otherwise.
See Alsoobjc_change()


menu_ienable()

WORD menu_ienable( tree, obj, flag )