## System

### Description

The System class implements the System object, which is the ultimate parent for all other objects belonging to a particular APL task. It gives information about the APLX system and allows your APL applications to use the Clipboard.

In addition, the System object of a child task is used to communicate with its parent (see the `Signal` method), and to share data using 'delta' properties.

If you use the ŚWI syntax, you do not need to create the System object; it always exists, under the name '#'. You can alternatively use the name 'Ś'. To use the System object using dot-notation, you need to get a reference to it using ŚNEW in the normal way:

          Sys„'Ś' ŚNEW 'System'

The main System properties and methods are:

#### System properties

`scale`: The scale used to position windows on the screen. The System object `scale` is inherited by all windows (and thus their controls) which you subsequently create.

`pointer`: The default mouse pointer type, which will be displayed unless the mouse is over a control which explicitly sets a different cursor.

`text`: The contents of the Clipboard, as a text vector. You can read this property to retrieve any text in the Clipboard, and write to it to place text in the Clipboard. If the Clipboard does not contain text, an empty vector is returned.

`unicode`: The contents of the Clipboard, as an integer vector comprising Unicode values. You can read this property to retrieve any Unicode text in the Clipboard, and write to it to place Unicode text in the Clipboard (you can write either integers, or characters). If the Clipboard does not contain Unicode text, an empty vector is returned.

`contents`: The contents of the Clipboard, returned if possible as an APL array. For example, you can copy a range of cells from Excel to the Clipboard, and read it into APL as a numeric or nested array. You can also write to the `contents` property, in which case the data will be available in the clipboard for APLX or for other applications to read back.

`picture`: (Windows and MacOS only) The contents of the Clipboard, as a Picture. You can read this property to retrieve any picture in the Clipboard, and write to it to place a picture on the Clipboard. The data is represented as a numeric vector, which internally holds a PICT or JPEG object under MacOS, or a Windows Enhanced Metafile under Windows. If the Clipboard does not contain a picture which is in or can be converted to PICT or Enhanced Metafile format, an empty vector is returned. (This property is not implemented under Linux - use the `bitmap` property instead.)

`bitmap`: The contents of the Clipboard, as a bitmap. You can read this property to retrieve any picture in the Clipboard, and write to it to place a picture on the Clipboard. The data is represented as an APL integer array of pixel color values. If the Clipboard does not contain a bitmap (or an image which can be converted to a bitmap), an empty matrix is returned.

`aplkeyboard`: An integer scalar. It is 1 if the APL keyboard is being used, and 0 if the default (non-APL) keyboard is in use. You can also set this under program control, with additional options for the APL keyboard layout. Setting the value to 1 means 'select whichever APL keyboard layout the user prefers'. Setting it to 2 selects the 'standard' APL keyboard layout, and 3 selects the 'unified' APL keyboard layout.

`aquaadjust`: A property which causes the size of certain controls to be enlarged slightly to take account of the MacOS X 'Aqua' appearance. This property is inherited by windows and controls which you create. It is ignored under Windows and Linux.

#### System read-only properties

`fonts`: A nested array of the names of screen fonts installed on the system.

`size`: The screen height and width in the current `scale`.

`workarea`: The rectangle within the screen size which available for application use, allowing for any task bar or application dock area reserved by the operating system. Note: Under Linux, this property returns the whole screen size.

`children`: A nested vector of the names of all the top-level objects (windows, pre-defined dialogs, etc) which you have created.

`version`: A five-element integer vector containing:

            [1] Version number for the System Class sub-system
            [2] GUI environment code 0=MacOS 1=Windows, 2=X-Windows, 4=Console only
            [3] OS Family code. For MacOS: 0 = Classic, 1 = OSX
                                For Windows: 0 = 95/98/ME, 1 = NT/2000/XP/Vista
            [4] OS Major version
            [5] OS Minor version

`classes`: A nested vector of character vectors, giving the names of all the System Classes available in your APLX system.

`xclasses`: A nested matrix of the OCX/ActiveX classes installed on your computer. This will always be empty under MacOS and Linux.

`oleclasses`: A nested matrix of the OLE Server Application classes installed on your computer. This will always be empty under MacOS and Linux.

`oledoctypes`: A nested matrix of the OLE document types for which applications are installed on your computer. This will always be empty under MacOS and Linux.

`file`: A character vector, containing the names of the files (or the command-line under Windows or Linux) which you need to open or print in your packaged APLX application.

`action`: A character vector containing the keyword 'open' or 'print' depending on how the user started up your packaged APLX application. It can be an empty vector if no operation is required.

`directory`: A character vector containing the path from which the running program (either APLX itself, or your packaged application) was loaded.

`printers`: A nested vector giving the names of the printers available on the system.

`taskid`: A unique integer identifying the APL task.

`host`: If you are running a Client-Server implementation of APLX, and the task is running on a Server, this property will contain the name (or IP address) of the server system. It will be '`localhost`' if the Client and the Server are running on the same machine. It will be an empty string if this is not a Client-Server configuration.

#### System methods

`Reset`: This method takes no arguments. It resets the System Class (ŚWI) sub-system to its initial state, deleting all objects.

`Signal`: Used by a child task to send a signal to its parent.

#### System events

`onAboutMenu`, `onPreferencesMenu` and `onQuitMenu`: These are triggered under MacOS to indicate that the user has selected a menu item from the system or application menu, which your packaged application needs to respond to.

`onOpen`: If you have packaged your APL workspace into a standalone application, this event is triggered under MacOS when the user drags a file icon on to your application icon once the application is running. The `file` and `action` properties indicate what files you need to open or print.

`onSignal`: Invoked when a parent task sends a signal to a child task.

### Example

         ’DEMO_System;OLDSCALE;Sys
    [1]   © Sample function demonstrating use of the System object
    [2]   ©
    [3]   © -- First show use of ŚWI syntax --
    [4]   © Show the screen size in pixels
    [5]   OLDSCALE„'Ś' ŚWI 'scale'
    [6]   'Ś' ŚWI 'scale' 5
    [7]   ''
    [8]   'Screen size: ',•'Ś' ŚWI 'size'
    [9]   'Ś' ŚWI 'scale' OLDSCALE
    [10]  ©
    [11]  © -- Now show use of dot-notation syntax --
    [12]  Sys„'Ś' ŚNEW 'System'
    [13]  ©
    [14]  'Program started from: ',Sys.directory
    [15]  'You have ',(•˝Sys.fonts),' fonts installed on your machine.'
    [16]  ©
    [17]  © Read the contents of any text in the clipboard
    [18]  ''
    [19]  'Text in the clipboard:'
    [20]  60˝'-'
    [21]  Sys.text
    [22]  60˝'-'
    [23]  ''
    [24]  ©
    [25]  © Set the clipboard contents
    [26]  Sys.text„'This was put in the clipboard by APLX'
    [27]  ©
    [28]  'Now try pasting text from the clipboard into a window'
         ’

### Properties

action aplkeyboard aquaadjust bitmap children class classes color contents data directory events file fonts host methods name oleclasses oledoctypes opened picture pointer printers properties scale self size taskid text tie unicode units version workarea xclasses

### Methods

Reset Send Set Signal Trigger

### Callbacks

onAboutMenu onOpen onPreferencesMenu onQuitMenu onSend onSignal

Topic: APLX Help : System Classes : List of Classes : System

[ Previous | Next | Contents | Index ]