xcall AUI, AUI_ENVIRONMENT, opcode, guiflags
The AUI_ENVIRONMENT class keeps track of properties and capabilities of the interface environment that affect the kind of user interface a program should use.
Parameters
opcode (Num) [in]
0 to retrieve the current attributes into guiflags, 1 to set them from guiflags. As a practical matter, you would probably never use opcode 1 since the flags are set automatically by A-Shell when the session is launched, and changing a flag isn't going to change the reality of the environment. Opcode 2 is a streamlined variation of 0 that skips the query of the ATE client to find out if it has Windows theme support or not. That detail is rarely of interest to applications; eliminating the query saves a few milliseconds for the round-trip query-and-response, although it probably makes little difference unless the application makes a lot of these calls.
guiflags (Num) [in/out]
Values for guiflags are shown in the following table, and are defined in ashell.def.
Symbol |
Value |
Description |
AGF_LWG |
&h0001 |
Local Windows w/ GUI (e.g. PCTDVG) |
AGF_LWN |
&h0002 |
Local Windows w/o GUI (e.g. PCTDV) |
AGF_ATE |
&h0004 |
Running on server via ATE connection |
AGF_RWN |
&h0008 |
Remote windows (ATS) |
AGF_TNT |
&h0010 |
Telnet |
AGF_ASH |
&h0020 |
A-Shell |
AGF_THEMES |
&h0040 |
Windows Themes are active |
AGF_HOLDKBD |
&h0080 |
Client currently holding kbd |
AGF_ATERES |
&h0100 |
Currently waiting on ATE response |
AGF_LOCWIN |
&h0003 |
Local Windows (AGF_LWN or AGF_LWG) |
AGF_ANYWIN |
&h000B |
Any windows platform (_LWN or _LWG or _RWN) |
AGF_GUIEXT |
&h0005 |
GUI extensions avail (AGF_LWG or AGF_ATE) |
AGF_LWNATE |
&h0007 |
Local Windows or ATE |
AGF_ATECLI |
&h0200 |
Running on ATE client (i.e. inside TELNET.LIT) |
AGF_INPROC |
&h0400 |
TAB(-10,x) command in progress |
AGF_ATESBX |
&h1000 |
We are in ATE-side SBX call |
&h2000 |
Disable the return of cstatus information |
|
AGF_DESIGN |
&h10000 |
Design mode |
Comments and Examples
All of these would start with retrieving the current guiflags as follows:
xcall AUI, AUI_ENVIRONMENT, 0, GUIFLAGS ! retrieve GUI flags
Before creating a graphical user interface with components from the AUI CONTROL class, you might want to check for either AGF_LWG or AGF_ATE. Since these are combined in AGF_GUIEXT, we can simply check it as follows:
if (GUIFLAGS and AGF_GUIEXT) then ? TAB(-10,x);.....
If you wanted to display a file for the user, either using NOTEPAD (if applicable) or else EZTYP (if not), you might use the following logic:
if (GUIFLAGS and AGF_LOCWIN) then
xcall HOSTEX,"NOTEPAD "+F$
elseif (((GUIFLAGS and AGF_ATE)#0) and ((GUIFLAGS and AGF_TNT)#0)) then
call XFER'TO'PC
call LAUNCH'NOTEPAD'ON'CLIENT
else
xcall EZTYP,F$
endif
In the above example, if running Windows locally, we can just launch NOTEPAD using HOSTEX. Otherwise, if running ATE on the client over telnet, we could transfer the file to the PC and then launch NOTEPAD, both of which could be done via Tab(-10,x) commands. Otherwise, we could just use EZTYP on the server. (You might also want to test for other telnet emulators, such as ZTERM, which are capable of doing file transfers and launching commands on the client, but that exceeds the scope of this example.) Note that when testing multiple AND conditions, you need the extra set of parentheses and the #0 test as shown above to get the desired effect. Otherwise the confusion between the logical and arithmetic AND in BASIC will cause the test to fail.
If you merely wanted to test whether you were running under A-Shell Windows or A-Shell/Unix (or some other platform, presumably AMOS), you could do this:
if (GUIFLAGS and AGF_ASH) then ! running A-Shell
if (GUIFLAGS and AGF_ANYWIN) ! any Windows platform
? "A-Shell Windows"
else
? "A-Shell Unix"
endif
else
? "Non A-Shell (AMOS?)"
endif
History
2006 January, A-Shell 4.9.949: The following will return the ATE version if the fourth parameter is specified and the client is ATE.
xcall AUI, AUI_ENVIRONMENT, 0, FLAGS {,ATEVER$}