Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕WSELF Callback object
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕WSELF Object Name


Just before your callback is called, the niladic system function ⎕WSELF is set to contain the fully-qualified name of the object to which the callback refers. This helps you to use the same callback function for several related objects. For example, you might have a general handler called LimitHit for several Edit fields, and you might wish to put up an alert when this is run (i.e. when the user tries to enter more characters than are allowed). This is how you might write the LimitHit function to cater for several different Edit objects:

       ∇LimitHit;max;msg
    [1]  ⍝ Put up alert if limit reached in Edit field
    [2]  max←⎕WSELF ⎕WI 'Limit'
    [3]  msg←'The maximum number of characters',⎕R
    [4]  msg←msg,'you can enter in this field is ',⍕max
    [5]  ALERT msg
       ∇

The value returned by ⎕WSELF outside callback functions is not reliable. In addition, if the object has been deleted in between the event occurring and your callback running, ⎕WSELF will give an empty vector.


Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕WSELF Callback object
[ Previous | Next | Contents | Index | APL Home ]