## Ś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 ]