(Obsolescent - Use ŚNEW and dot notation instead)
The older-style of interface from APL to the object-based programming environment (System Classes) is built around the system function ŚWI. This takes a left argument which is the name of the object, and a right argument which names the property or method you wish to access, and if appropriate the value you wish to assign to the property or pass to the method. When you create an object, you can optionally set properties at creation time, otherwise the system chooses defaults. The following examples show how this works:
Create a top-level object called Example, in this case a window with the standard Dialog border and appearance:
'Example' ŚWI 'New' 'Dialog'
Create an object called Lst1, of class List Box, on the window Example (the system chooses defaults for things like size and position):
'Example.Lst1' ŚWI 'New' 'List'
Set the size property of the list you just created to be 5 standard rows high and 30 columns wide (the object will immediately be re-sized):
'Example.Lst1' ŚWI 'size' 5 30
Create an object called Lst1, as above, but this time set the size property at the time you create it:
'Example.Lst1' ŚWI 'New' 'List' ('size' 5 30)
Put a set of choices (contained in the variable NAMES) into the list box by setting its list property:
'Example.Lst1' ŚWI 'list' NAMES
Read back the selection which the user has made by reading the value property of the list box:
'Example.Lst1' ŚWI 'value' 2
The exact syntax of ŚWI for the three possible cases is as follows:
Setting a property:
ObjectName ŚWI PropertyName Value
ObjectName and PropertyName are character vectors, and Value can be any APL array valid for the particular property in question. The right argument to ŚWI is thus a two-element nested vector. However, as a convenience ŚWI accepts any length of nested array vector and treats the first element as the property name and the rest of the argument as the property value, so that the following two statements are both valid and do exactly the same thing:
'Win1.But' ŚWI 'where' (12 20 3 8) © Two-element vector 'Win1.But' ŚWI 'where' 12 20 3 8 © Five-element vector
Reading a property:
Value „ ObjectName ŚWI PropertyName
ObjectName and PropertyName are character vectors as before, and the current value for the property is returned as the explicit result of ŚWI. For example:
'Win1.But' ŚWI 'where' 12 20 3 8 'Win1.But' ŚWI 'caption' Cancel
Invoking a method:
ObjectName ŚWI MethodName {Argument}
ObjectName and MethodName are character vectors, and Argument is an optional argument to the method. It can be any APL array valid for the particular method in question. Again, ŚWI accepts any length of nested array vector and treats the first element as the method name and the rest as the argument to the method.
'Win1.Movie' ŚWI 'Rewind' © Method with no argument 'Win1.But' ŚWI 'New' 'Button' © Argument is 'Button'
See the separate documentation on System Classes and User-Interface Programming for full details.
In Console versions of APLX, there is no GUI interface and therefore nearly all of ŚWI is not implemented. Only the Socket object, and a subset of the System object, are currently available. In Client-Server edititions of APLX, ŚWI is fully implemented, and runs on the Client machine.