Adding event handling scripts

Event handling scripts are declared in ArcPad Extensible Markup Language (XML) files an attribute of an object that is capable of generating events. All event handler attributes use the naming convention of on[name] where [name] is the event type name. For example, the declaration for a form button control that handles an OnClick event would appear as follows:

<BUTTON name ="ok" onclick="Call OKClicked" .... />

The above button would call the subroutine OKClicked when it's clicked.

Although you can type a complete script in the Event Script text box for each event, it's often more efficient to type all the scripts needed for a customization file in a single VBScript source code file as subroutines and functions. You can then call the appropriate subroutine or function in the Event Script text box for each event.

Adding an event handling script to a form event

Steps:
  1. Open an existing form in the Form Editor.
  2. Click the Form menu and click Form Properties.

    The Form Properties dialog box appears.

  3. Click the Events tab.
  4. Click the event to which you want to associate a script.
  5. Type or paste the script into the Event Script box.
  6. Click OK.

Associating a script with a page event

Steps:
  1. Open an existing form in the Form Editor.
  2. Click the tab of the page to which you want to associate the event.
  3. Click the Page menu and click Page Properties.

    The Page Properties dialog box appears.

  4. Click the Events tab.
  5. Click the event to which you want to associate a script.
  6. Type or paste the script into the Event Script box.
  7. Click OK.

Associating a script with a control event

Steps:
  1. Open an existing form in the Form Editor.
  2. Click the tab of the page containing the control to which you want to associate the event.
  3. Click the Control menu and click Control Properties.

    The Control Properties dialog box appears.

  4. Click the Events tab.
  5. Click the event to which you want to associate a script.
  6. Type or paste the script into the Event Script box.
  7. Click OK.

Associating an event script with a custom tool event

Steps:
  1. Create or open an applet or default configuration file containing at least one toolbar.
  2. Click the Toolbars button Toolbars button on the toolbar.

    The Toolbars dialog box appears.

  3. Click the toolbar containing the custom tool to which you want to associate an event script.
  4. Click the Edit button.

    The Toolbar dialog box appears.

  5. Click the custom tool to which you want to associate an event script.
  6. Click the Edit button.
  7. On the Events page of the Tool Properties dialog box, click the event to which you want to associate a script.
  8. Type or paste the script into the Event Script box.
  9. Repeat steps 7 and 8 to add additional event scripts.
  10. Click OK.
  11. Click OKOK on the Toolbar dialog box.
  12. Click OK on the Toolbars dialog box.

Associating an event script with a system object event

Steps:
  1. Create or open an applet, default configuration, or layer definition file.
  2. Click the System Objects button System Objects buttonon the toolbar.

    The System Objects dialog box appears.

  3. Click the object to which you want to associate an event script.
  4. Click the event to which you want to associate an event script.
  5. Type or paste the script into the Event Script box.
  6. Repeat steps 3–5 to add additional event scripts for the system objects.
  7. Click OK.

2/7/2013