Formulario arcpad

29
Customizing forms: an overview Related topics ArcPad supports customization of four kinds of forms: Edit forms Identify forms General forms Query forms Forms are developed and edited with the Form Wizard and/or Form Editor in ArcPad Studio. The Form Wizard is available only for edit forms in layer definitions. The Form Editor is available for all types of customization files - applets, default configuration files, and layer definitions. With layer definitions, you can create custom edit, identify, and query forms that are associated with specific shapefiles or ArcPad AXF file layers, as well as general forms. General forms are not associated with specific layers, and can act as input forms, display forms, or any form that your application requires. With default configuration files and applets, you can only create general forms. Each form you create is stored with its particular type of customization file. That is, layer forms are stored in the layer file for shapefiles (*.apl) and in the ArcPad AXF file for ArcPad AXF layers, applet forms are stored in the applet file (*.apa) and default configuration file forms are stored in the default configuration file (arcpad.apx). ArcPad supports a rich set of form controls. Each control has a set of attributes that define it, which are listed in the Control Properties dialog box. For example, the X and Y attributes of a control determine the control's location on the form. Each control also has a set of properties and methods that are used to retrieve information about the control or modify various aspects of the control at run-time, via scripts. In addition, some controls generate a range of events as they are operating, and scripts can be called when these events occur. For example, a Button control generates an OnClick event each time it is clicked. A script can be associated with this event, allowing the form to perform custom actions such as the calculation of one control value based on the values of other controls. The set of available controls includes: Edit forms Edit forms replace the Feature Properties dialog box and are used for data entry, such as updating the values of a feature's attributes. Each edit form you create must be associated with a specific layer. Control Description This is a label. A Label control displays static text such as captions or instructions for using the form. Fred A ComboBox control displays a single column list of choices that appears to drop down when you click it. An Edit control accepts one or more lines of information from you or displays one or more lines of information provided by the application. Fred Barney Wilma Betty A ListBox control displays a single or multicolumn list of choices. The columns of the list box cannot be edited. Calculate A Button control performs a task when you click it. The text on the button describes its actions. Checked A CheckBox control allows a user to turn on (check) or turn off (uncheck) an option in the form. Selected A RadioButton control can be combined with other RadioButton controls to provide an exclusive set of choices. A DateTime control accepts a date from you, or displays a date provided by the application. A calendar appears to drop down when you click it. An UpDown control allows you to set a discrete value within a finite range of values, via its buddy Edit control. An UpDown control is oriented vertically. A Slider control allows you to set a discrete value within a finite range of values, via its buddy Edit control. A Slider control is oriented horizontally. An ImageBox control displays a static picture on the form, such as a company logo. The supported file formats are: JPEG, MrSid, and bitmap files. A SymbologyField control links to a layer's legend. SymbologyField controls automatically display a feature's symbol and label as defined in the layer's symbology. You can select any symbol defined in the legend in a SymbologyField control. SymbologyField controls can only be added to layer forms. Fred A DomainField control automatically presents valid values from a subtype or domain (coded value or range domain) defined on a field in an ArcPad AXF layer. It also automatically switches between different domains when governed by a subtype (that is, no domain, range domain, or coded value domain). DomainField controls are available in the Fields palette in the Form Editor for fields that have domains. DomainFields are only supported for ArcPad AXF files (that is, the DomainField control is not supported for shapefile fields). When used with a subtype field, the DomainField control appears as a combo box, but automatically changes itself depending on the value of the subtype. DomainField controls can only be added to layer forms. Page 1 of 29 Customizing forms: an overview 31/01/2011 file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Transcript of Formulario arcpad

Page 1: Formulario arcpad

Customizing forms: an overview

Related topics

ArcPad supports customization of four kinds of forms:

Edit forms

Identify forms

General forms

Query forms

Forms are developed and edited with the Form Wizard and/or Form Editor in ArcPad Studio. The Form Wizard is available only for edit forms in layer definitions. The Form Editor is available for all types of customization files - applets, default configuration files, and layer definitions. With layer definitions, you can create custom edit, identify, and query forms that are associated with specific shapefiles or ArcPad AXF file layers, as well as general forms. General forms are not associated with specific layers, and can act as input forms, display forms, or any form that your application requires. With default configuration files and applets, you can only create general forms. Each form you create is stored with its particular type of customization file. That is, layer forms are stored in the layer file for shapefiles (*.apl) and in the ArcPad AXF file for ArcPad AXF layers, applet forms are stored in the applet file (*.apa) and default configuration file forms are stored in the default configuration file (arcpad.apx).

ArcPad supports a rich set of form controls. Each control has a set of attributes that define it, which are listed in the Control Properties dialog box. For example, the X and Y attributes of a control determine the control's location on the form. Each control also has a set of properties and methods that are used to retrieve information about the control or modify various aspects of the control at run-time, via scripts. In addition, some controls generate a range of events as they are operating, and scripts can be called when these events occur. For example, a Button control generates an OnClick event each time it is clicked. A script can be associated with this event, allowing the form to perform custom actions such as the calculation of one control value based on the values of other controls.

The set of available controls includes:

Edit forms Edit forms replace the Feature Properties dialog box and are used for data entry, such as updating the values of a feature's attributes. Each edit form you create must be associated with a specific layer.

Control Description

This is a label. A Label control displays static text such as captions or instructions for using the form.

Fred A ComboBox control displays a single column list of choices that appears to drop down when you click it.

An Edit control accepts one or more lines of information from you or displays one or more lines of information provided by the application.

FredBarneyWilmaBetty

A ListBox control displays a single or multicolumn list of choices. The columns of the list box cannot be edited.

Calculate A Button control performs a task when you click it. The text on the button describes its actions.

Checked A CheckBox control allows a user to turn on (check) or turn off (uncheck) an option in the form.

Selected A RadioButton control can be combined with other RadioButton controls to provide an exclusive set of choices.

A DateTime control accepts a date from you, or displays a date provided by the application. A calendar appears to drop down when you click it.

An UpDown control allows you to set a discrete value within a finite range of values, via its buddy Edit control. An UpDown control is oriented vertically.

A Slider control allows you to set a discrete value within a finite range of values, via its buddy Edit control. A Slider control is oriented horizontally.

An ImageBox control displays a static picture on the form, such as a company logo. The supported file formats are: JPEG, MrSid, and bitmap files.

A SymbologyField control links to a layer's legend. SymbologyField controls automatically display a feature's symbol and label as defined in the layer's symbology. You can select any symbol defined in the legend in a SymbologyField control. SymbologyField controls can only be added to layer forms.

Fred A DomainField control automatically presents valid values from a subtype or domain (coded value or range domain) defined on a field in an ArcPad AXF layer. It also automatically switches between different domains when governed by a subtype (that is, no domain, range domain, or coded value domain). DomainField controls are available in the Fields palette in the Form Editor for fields that have domains. DomainFields are only supported for ArcPad AXF files (that is, the DomainField control is not supported for shapefile fields). When used with a subtype field, the DomainField control appears as a combo box, but automatically changes itself depending on the value of the subtype. DomainField controls can only be added to layer forms.

Page 1 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 2: Formulario arcpad

Identify forms Identify forms replace the Feature Properties dialog box and are used to view, but not edit, a feature's attributes. This allows you to view data in a different style when a feature is being identified as opposed to when it is being edited. Like edit forms, each identify form you create must be associated with a specific layer.

Query forms Query forms add custom, layer specific query pages to ArcPad's Find dialog box. Query forms you create must be associated with a specific layer. Query forms can have multiple pages - when they do each page is treated independently of others in the Find dialog box. That is, only the fields and operators used on the active page are used for the query.

General forms General forms are created without any association with a layer. For example, an applet can provide a custom toolbar with a user-defined command that displays a form. The form takes user input, performs several calculations, displays a message to the user, and then closes.

When you create a general form, you must give it a name. This name is then used to access the form within a script. For example, a toolbutton's OnClick event handler script displays an applet form named 'frmCalculator'.

The VBScript code to accomplish this would be :

Applet.Forms("frmCalculator").Show

The JScript code would be :

Applet.Forms("frmCalculator").Show();

Script code similar to the above might be also used in another form to handle a Button control's OnClick event.

Attributes Vs. Properties

See Also

Forms, pages, and controls have attributes that define their behavior (for example, name, caption, width, and so on). These attributes are set at design-time in ArcPad Studio and cannot be accessed or modified at run-time via scripts. However, the Form, Page, and Control objects have properties that can be accessed and, in some cases, modified at run-time via scripts. Not all attributes have corresponding properties and not all properties have corresponding attributes. Below are lists of all the properties of the Form, Page, and Control objects and, where applicable, their corresponding attributes.

Form

Page

Tip

If no edit form is supplied, but an identify form is supplied, the identify form is displayed in edit mode.

Tip

If no identify form is supplied, but an edit form is supplied, the edit form is displayed in identify mode.

Tip

Create a query form for a layer when you want to include steamlined layer queries with that layer that appear in ArcPad's Find dialog whenever the layer is present in a map.

Property Attribute Notes

ActivePage N/A  

Caption caption Read/write.

Fields N/A  

hWnd N/A  

Mode N/A  

Name name Read-only.

Pages N/A  

Property Attribute Notes

Caption caption Read/write.

Controls N/A  

hWnd N/A  

Index N/A  

IsActive N/A  

Page 2 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 3: Formulario arcpad

Control

Using Forms

See Also

Use a form to organize a single task or set of related tasks onto a single window. A form contains one or more pages. Here's an example of a form with two pages:

Forms are represented by Form objects in the ArcPad object model and by FORM elements in ArcPad XML.

Attributes Form attributes are set at design-time in ArcPad Studio in the Form Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Form Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the form. Used to reference the form in scripts. backgroundcolor - The background color to use for the form. This can be overridden by setting a page's or control's backgroundcolor attribute. caption - The text appearing in the form's title bar. color - The color to use for the form's text. This can be overridden by setting a page's or control's color attribute. width - The width of the form. height - The height of the form.

Name name Read-only.

Parent N/A  

Property Attribute Notes

DefaultValue defaultvalue Read/write. The defaultvalue attribute is supported by the following controls: CheckBox, ComboBox, DateTime, DomainField, Edit, ImageBox, ListBox, Silder, and SymbologyField.

Enabled readonly Read/write. The readonly attribute is supported by the following controls: CheckBox, ComboBox, DateTime, DomainField, Edit, ImageBox, ListBox, RadioButton, Slider, and SymbologyField.

Field field Read-only. The field attribute is supported by the following controls: CheckBox, ComboBox, DateTime, DomainField, Edit, ImageBox, ListBox, RadioButton, and Slider.

hWnd N/A  

Index N/A  

ListCount N/A  

ListIndex N/A  

Name name Read-only. All controls support the name attribute.

Parent N/A  

Properties listtable Read-only. The listtable attribute is supported by ComboBox and ListBox controls.

Text caption Read/write. The caption attribute is supported by the following controls: Button, CheckBox, and RadioButton.

Type N/A  

Value value Read/write.

Visible N/A  

Page 3 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 4: Formulario arcpad

tabsvisible - Specifies if the form contains tabs (pages). font - The font to use for the form. fontsize The font size to use for the form. fontstyle The font style to use for the form. attributespagevisible - Specifies if the attributes page is displayed with the form (edit/identify forms only). symbologypagevisible - Specifies if the symbology page is displayed with the form (edit/identify forms only). geographypagevisible - Specifies if the geography page is displayed with the form (edit/identify forms only). picturepagevisible - Specifies if the picture page is displayed with the form (edit/identify forms only). sip - Specifies whether the SIP (soft input panel) is displayed on pen devices by default when controls get the focus. onload - The script to run when an OnLoad event occurs. onunload - The script to run when an OnUnload event occurs. onsetactive - The script to run when an OnSetActive event occurs. onkillactive - The script to run when an OnKillActive event occurs. onok - The script to run when an OnOK event occurs. oncancel - The script to run when an OnCancel event occurs. onrefresh - The script to run when an OnRefresh event occurs (edit/identify forms only).

Events Forms generate a range of events as they are operating. You can specify a script to run whenever any of these events occur. The following form events are available:

OnCancel - Occurs when the Cancel button is clicked in the form. OnKillActive - Occurs when the form loses the focus. OnLoad - Occurs when the form is loaded. OnOK - Occurs when the OK button is clicked in the form. OnRefresh - Occurs when the displayed identify form is updated. OnSetActive - Occurs when the form gets the focus. OnUnload - Occurs when the form is unloaded.

Properties Form properties can be read and set at run-time via scripts. The following form properties are available:

ActivePage - Returns a reference to the currently displayed page of the form. Caption - Returns or sets the caption to display for the form. Fields - Returns a reference to the fields of the current record (edit/identify forms only). hWnd - Returns the window handle of the form. Mode - Returns a value that indicates how the form is being used. Name - Returns the name of the form. Pages - Returns a reference to the pages of the form.

Methods Form methods can be called at run-time via scripts. The following form methods are available:

Close - Closes the form. Show - Displays the general form.

Getting a reference to a form You can only reference a form that is currently displayed. Attempting to reference a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a form:

Direct reference This involves referencing a form via its name and parent object. For example, to reference a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheForm Set pTheForm = Applet.Forms("frmSettings")

JScript

var pTheForm; pTheForm = Applet.Forms("frmSettings");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same form from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheForm Set pTheForm = Applets("Custom Settings").Forms("frmSettings")

JScript

var pTheForm; pTheForm = Applets("Custom Settings").Forms("frmSettings");

To reference forms from witin a particular layer use Layer.Forms To reference forms from within an applet use Applet.Forms To reference forms from within the default configuration file (arcpad.apx), use Application.Forms

Event reference This involves referencing a form in an event handling script. For example, to reference a form in its OnLoad event handler, you would use the code:

VBScript

Dim pTheForm Set pTheForm = ThisEvent.Object

JScript

Page 4 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 5: Formulario arcpad

var pTheForm; pTheForm = ThisEvent.Object;

To reference a form in the OnLoad event handler of one of the form's pages, you would use the code:

VBScript

Dim pTheForm Set pTheForm = ThisEvent.Object.Parent

JScript

var pTheForm; pTheForm = ThisEvent.Object.Parent;

Displaying a general form In order to display a form, you reference the form and call its Show method, passing in the name of the form. For example, to display a form named "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Applet.Forms("frmSettings").Show

JScript

Applet.Forms("frmSettings").Show();

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to display the same form from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Application.Applets("Custom Settings").Forms("frmSettings").Show

JScript

Application.Applets("Custom Settings").Forms("frmSettings").Show();

To display forms from within a particular layer use Layer.Forms To display forms from within an applet use Applet.Forms To display forms from within the default configuration file (arcpad.apx), use Application.Forms

 

 

 

 

Initializing a form Form initialization involves setting particular form properties when the form is first displayed. Generally, the form's OnLoad event handler is the most appropriate place to do this. For example, the following code would change the form's caption to "New Caption" when called in the OnLoad event handler:

VBScript

ThisEvent.Object.Caption = "New Caption"

JScript

ThisEvent.Object.Caption = "New Caption";

Referencing attribute fields for the current feature in an edit form You can reference the Fields object that represents the fields of the feature currently being edited in an edit form. This is useful if you want to read or modify field values that are not present in the edit form. Generally, the form's OnLoad event handler is the most appropriate place to do this. For example, the following code would write the current date to a field called LASTEDIT when called in the edit form's OnLoad event handler (NOTE: the field LASTEDIT must be present in the layer or the script will generate an error):

VBScript

Dim pFields Set pFields = ThisEvent.Object.Fields pFields("LASTEDIT").Value = FormatDateTime(Now,vbShortDate)

JScript

var pFields, dtDate, strToday; Set pFields = ThisEvent.Object.Fields(); dtDate = new Date(); strToday = (dtDate.getMonth() + 1) + "/"; strToday += dtDate.getDate() + "/"; strToday += dtDate.getYear(); pFields("LASTEDIT").Value = strToday;

Tip

If you want to display data-related forms such as edit forms programmatically within ArcPad, the following commands can be used to open such forms: Map.addFeature or Map.addFeatureXY invokes the edit form for a feature; Map.IdentifyXY invokes an identify form; Application.ExecuteCommand("Find") invokes a query form.

Page 5 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 6: Formulario arcpad

Using Pages

See Also

Use a page to organize one or more related controls in a form. A page is the canvas upon which you place your controls. Every form must have a least one page.

Pages are represented by Page objects in the ArcPad object model and by PAGE elements in ArcPad XML.

Attributes Page attributes are set at design-time in ArcPad Studio in the Page Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Page Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the page. Used to reference the page in scripts. backgroundcolor - The background color to use for the page. This can be overridden by setting a control's backgroundcolor attribute. If not specified, this value is inherited from the form's backgroundcolor attribute. caption - The text appearing in the page's tab. color - The color to use for the page. This can be overridden by setting a control's color attribute. If not specified, this value is inherited from the form's color attribute. font - The font for the page. This can be overridden by setting a control's font attribute. If not specified, this value is inherited from the form's font attribute. fontsize - The font size for the page. This can be overridden by setting a control's fontsize attribute. If not specified, this value is inherited from the form's fontsize attribute. fontstyle - The font style for the page. This can be overridden by setting a control's fontstyle attribute. If not specified, this value is inherited from the form's fontstyle attribute. sip - Specifies whether the SIP (soft input panel) is displayed on pen devices by default when controls get the focus. onload - The script to run when an OnLoad event occurs. onunload - The script to run when an OnUnload event occurs. onsetactive - The script to run when an OnSetActive event occurs. onkillactive - The script to run when an OnKillActive event occurs. onok - The script to run when an OnOK event occurs. oncancel - The script to run when an OnCancel event occurs. onquerycancel - The script to run when an OnQueryCancel event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events Pages generate a range of events as they are operating. You can specify a script to run whenever any of these events occur. The following page events are available:

OnCancel - Occurs when the Cancel button is clicked in the page. OnKillActive - Occurs when the page loses the focus. OnLoad - Occurs when the page is loaded. OnOK - Occurs when the OK button is clicked in the page. OnQueryCancel - Occurs for every page before the OnCancel event occurs when the Cancel button is clicked in a form. OnSetActive - Occurs when the page gets the focus. OnUnload - Occurs when the page is unloaded. OnValidate - Occurs after all Control objects' OnValidate events fire on the page.

Properties Page properties can be read and set at run-time via scripts. The following page properties are available:

Caption - Returns or sets the caption to display for the page. Controls - Returns a reference to the controls object for the page. hWnd - Returns the window handle of the page. Index - Returns the index of the page. IsActive - Returns True if the page is currently displayed; False otherwise. Name - Returns the name of the page. Parent - Returns a reference to the form that contains the page.

Methods Page methods can be called at run-time via scripts. The following page methods are available:

Activate - Displays the page. Validate - Fires the OnValidate event for all controls on the page.

Getting a reference to a page You can only reference a page of a form that is currently displayed. Attempting to reference a page of a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a page:

Direct reference This involves referencing a page via its name, its form's name, and its form's parent object. For example, to reference a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pThePage Set pThePage = Applet.Forms("frmSettings").Pages("pgPage1")

JScript

var pThePage; pThePage = Applet.Forms("frmSettings").Pages("pgPage1");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same page from a different applet, or other customization file, you need to explicitly reference the applet. For example:

Page 6 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 7: Formulario arcpad

VBScript

Dim pThePage Set pThePage = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1")

JScript

var pThePage; pThePage = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1");

To reference forms from within a particular layer definition use Layer.Forms To reference forms from within an applet use Applet.Forms To reference forms from within the default configuration file (arcpad.apx), use Application.Forms

Event reference This involves referencing a page in an event handling script. For example, to reference a page in its OnLoad event handler, you would use the code:

VBScript

Dim pThePage Set pThePage = ThisEvent.Object

JScript

var pThePage; pThePage = ThisEvent.Object;

To reference a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pThePage Set pThePage = ThisEvent.Object.Pages("pgPage1")

JScript

var pThePage; pThePage = ThisEvent.Object.Pages("pgPage1");

Displaying a page By default, the first page of a form is displayed when the form is initially displayed. Use the Activate method to display a different page. The IsActive property tells you if a page is currently displayed. For example, if you have a form with two pages--"pgPageOne" and "pgPageTwo", you could display the second page initially by using the following code in the form's OnLoad event handler:

VBScript

Dim pTheForm Set pTheForm = ThisEvent.Object pTheForm.Pages("pgPageTwo").Activate

JScript

var pTheForm; pTheForm = ThisEvent.Object; pTheForm.Pages("pgPageTwo").Activate();

Initializing a page Page initialization involves setting particular page properties when the page is first displayed. Generally, the OnLoad event handler is the most appropriate place to do this. For example, the following code would change the page's caption to "New Page Caption" when called in the page's OnLoad event handler:

VBScript

ThisEvent.Object.Caption = "New Page Caption"

JScript

ThisEvent.Object.Caption = "New Page Caption";

Preventing the Cancel button from closing the form When the Cancel button is pressed on a form, an OnQueryCancel event is fired by the active page. By handling this event, you can add logic to prevent the form from closing. Since the OnQueryCancel event is fired by the Page object, and not the Form object, you must handle this event in every page of a form if you want to handle it at all. For example, the following code would prompt the user before closing the form when called in each page's OnQueryCancel event handler:

VBScript

Dim bResult bResult = Application.MessageBox ("Cancel for sure?", apYesNo, "Cancel?") If bResult = apNo Then ThisEvent.Result = False End If

JScript

var bResult; bResult = Application.MessageBox ("Cancel for sure?", apYesNo, "Cancel?"); if (bResult == apNo) ThisEvent.Result = false;

Using Button Controls

See Also

Page 7 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 8: Formulario arcpad

Use a Button control to begin or end a process. A button contains a text label that indicates what the button does when pushed.

Button controls are represented by Control objects in the ArcPad object model and by BUTTON elements in ArcPad XML.

Attributes Button control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the Button control. Used to reference the Button control in scripts. caption - The text appearing in the button. width - The width of the button. height - The height of the button. x - The x coordinate of the upper left corner of the button. y - The y coordinate of the upper left corner of the button. alignment - The alignment of the button's caption. group - Specifies whether the button starts a new group of controls. border - Specifies whether the button has a border. tabstop - Specifies whether the TAB key can be used to move the focus to the button. backgroundcolor - The background color to use for the button. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the button's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the button's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the button's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the button's text. If not specified, this value is inherited from the page's fontstyle attribute. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onclick - The script to run when an OnClick event occurs.

Events Button controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following Button control events are available:

OnClick - Occurs when the button is clicked. OnKillFocus - Occurs when the button loses the focus. OnSetFocus - Occurs when the button gets the focus.

Properties Button control properties can be read and set at run-time via scripts. The following Button control properties are available:

Enabled - Returns or sets a value that determines if the button is enabled. hWnd - Returns the window handle of the button. Index - Returns the index of the button. Name - Returns the name of the button. Parent - Returns a reference to the page that contains the button. Text - Returns or sets the text to display for the button. Type - Returns the type of the control ("BUTTON" for a button). Value - Returns or sets the value of the button. Visible - Returns or sets a value that determines whether the button is visible.

Methods Button control methods can be called at run-time via scripts. The following Button control methods are available:

SetFocus - Sets the focus to the button.

Getting a reference to a Button control You can only reference a Button control in a form that is currently displayed. Attempting to reference a Button control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a Button control:

Direct reference This involves referencing a Button control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a Button control with the name "btnClickMe" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheButton Set pTheButton = Applet.Forms("frmSettings").Pages("pgPage1").Controls("btnClickMe")

JScript

var pTheButton; pTheButton = Applet.Forms("frmSettings").Pages("pgPage1").Controls("btnClickMe");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same Button control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheButton Set pTheButton = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("btnClickMe")

JScript

var pTheButton; pTheButton = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("btnClickMe");

Event reference This involves referencing a Button control in an event handling script. For example, to reference a Button control in its OnClick event handler, you would use the code:

Page 8 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 9: Formulario arcpad

VBScript

Dim pTheButton Set pTheButton = ThisEvent.Object

JScript

var pTheButton; pTheButton = ThisEvent.Object;

To reference a Button control with the name "btnClickMe" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheButton Set pTheButton = ThisEvent.Object.Pages("pgPage1").Controls("btnClickMe")

JScript

var pTheButton; pTheButton = ThisEvent.Object.Pages("pgPage1").Controls("btnClickMe");

Initializing a Button control Button initialization involves setting particular button properties when the button is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would make a button with the name "btnClickMe" inactive and change its caption to "Click Me" when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("btnClickMe").Text = "Click Me" pTheControls("btnClickMe").Enabled = False

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls; pTheControls("btnClickMe").Text = "Click Me"; pTheControls("btnClickMe").Enabled = false;

Clicking a Button Control To click a button (and fire the Button control's OnClick event), set its Value property to True. For example, the following code would click a button referenced by the variable pTheButton:

VBScript

pTheButton.Value = True

JScript

pTheButton.Value = true;

Using CheckBox Controls

See Also

Use a CheckBox control to present a yes or no choice, or a true or false choice. When associated with an attribute field, a checked check box represents a true value and an unchecked check box represents a false value.

CheckBox controls are represented by Control objects in the ArcPad object model and by CHECKBOX elements in ArcPad XML.

Attributes CheckBox control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the CheckBox control. Used to reference the CheckBox control in scripts. width - The width of the check box. height - The height of the check box. x - The x coordinate of the upper left corner of the check box. y - The y coordinate of the upper left corner of the check box. alignment - The alignment of the check box's caption. group - Specifies whether the check box starts a new group of controls. border - Specifies whether the check box has a border. tabstop - Specifies whether the TAB key can be used to move the focus to the check box. caption - The caption displayed to the right of the check box. defaultvalue - A simple expression that specifies the default value of the check box. required - Specifies if the user must check the check box. field - The field of the shapefile's DBF table that is linked to the check box. readonly - Specifies whether the check box's value can be modified by the user. backgroundcolor - The background color to use for the check box. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the check box's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the check box's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the check box's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the check box's text. If not specified, this value is inherited from the page's fontstyle attribute. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs.

Page 9 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 10: Formulario arcpad

onclick - The script to run when an OnClick event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events CheckBox controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following CheckBox control events are available:

OnClick - Occurs when the user clicks (checks or unchecks) the check box. OnKillFocus - Occurs when the check box loses the focus. OnSetFocus - Occurs when the check box gets the focus. OnValidate - Occurs when the check box is validated. Properties CheckBox control properties can be read and set at run-time via scripts. The following CheckBox control properties are available:

DefaultValue - Returns or sets the default value expression for the check box. Enabled - Returns or sets a value that determines if the check box is enabled. Field - Returns a reference to the feature attribute field to which the check box is bound. hWnd - Returns the window handle of the check box. Index - Returns the index of the check box. Name - Returns the name of the check box. Parent - Returns a reference to the page that contains the check box. Text - Returns or sets the text displayed to the right of the check box. Type - Returns the type of the control ("CHECKBOX" for a check box). Value - Returns or sets a value that determines whether the check box is checked. Visible - Returns or sets a value that determines whether the check box is visible. Methods CheckBox control methods can be called at run-time via scripts. The following CheckBox control methods are available:

SetFocus - Sets the focus to the check box.

Getting a reference to a CheckBox control You can only reference a CheckBox control in a form that is currently displayed. Attempting to reference a CheckBox control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a CheckBox control:

Direct reference This involves referencing a CheckBox control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a CheckBox control with the name "chkActivate" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheCheckBox Set pTheCheckBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("chkActivate")

JScript

var pTheCheckBox; pTheCheckBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("chkActivate");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same CheckBox control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheCheckBox Set pTheCheckBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("chkActivate")

JScript

var pTheCheckBox; pTheCheckBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("chkActivate");

Event reference This involves referencing a CheckBox control in an event handling script. For example, to reference a CheckBox control in its OnClick event handler, you would use the code:

VBScript

Dim pTheCheckBox Set pTheCheckBox = ThisEvent.Object

JScript

var pTheCheckBox; pTheCheckBox = ThisEvent.Object;

To reference a CheckBox control with the name "chkActivate" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheCheckBox Set pTheCheckBox = ThisEvent.Object.Pages("pgPage1").Controls("chkActivate")

JScript

var pTheCheckBox; pTheCheckBox = ThisEvent.Object.Pages("pgPage1").Controls("chkActivate");

Initializing a CheckBox control

Page 10 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 11: Formulario arcpad

Check box initialization involves setting particular check box properties when the check box is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would display a check box with the name "chkActivate" as checked when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("chkActivate").Value = True

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls; pTheControls("chkActivate").Value = true;

Checking and unchecking a CheckBox control To check a check box at run-time, set its Value property to True. To uncheck it, set its Value property to False. For example, to uncheck a check box referenced by the variable pTheCheckBox, use the following code:

VBScript

pTheCheckBox.Value = False

JScript

pTheCheckBox.Value = false;

Using ComboBox Controls

See Also

Use a ComboBox control to provide a list of choices when there is a minimum amount of space available on your form. The list of choices drops down allowing you to select a choice. A combo box combines the features of a text box and a list box. You can select an item by either typing text into the combo box or by selecting it from the list.

ComboBox controls are represented by Control objects in the ArcPad object model and by COMBOBOX elements in ArcPad XML.

Attributes ComboBox control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the ComboBox control. Used to reference the ComboBox control in scripts. width - The width of the combo box. height - The height of the combo box when it drops down. x - The x coordinate of the upper left corner of the combo box. y - The y coordinate of the upper left corner of the combo box. sip - Specifies if the SIP (soft input panel) is displayed on pen devices when the combo box gets the focus. required - Specifies if the user must select an item in the combo box. defaultvalue - A simple expression that specifies the default value of the combo box. group - Specifies whether the combo box starts a new group of controls. border - Specifies whether the combo box has a border. tabstop - Specifies whether the TAB key can be used to move the focus to the combo box. readonly - Specifies whether the combo box's value can be modified by the user. listtable - The DBF table used to populate the combo box. listvaluefield - The field of the DBF table that contains the data used to populate the value component of the combo box's items. listtextfield - The field of the DBF table that contains the data used to populate the text component of the combo box's items. field - The field of the shapefile's DBF table that is linked to the combo box. limittolist - Specifies if the text box portion of the combo box can accept text. maxvalue - Specifies the maximum value allowed for the combo box. This can be a numeric or text value. minvalue - Specifies the minimum value allowed for the combo box. This can be a numeric or text value. sort -Specifies if the items in the combo box are automatically sorted alphabetically. backgroundcolor - The background color to use for the combo box. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the combo box's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the combo box's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the combo box's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the combo box's text. If not specified, this value is inherited from the page's fontstyle attribute. onchange - The script to run when an OnChange event occurs. oncloseup - The script to run when an OnCloseUp event occurs. ondropdown - The script to run when an OnDropDown event occurs. onselchange - The script to run when an OnSelChange event occurs. onselcancel - The script to run when an OnSelCancel event occurs. onselok - The script to run when an OnSelOK event occurs. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events ComboBox controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following ComboBox control events are available:

OnChange - Occurs when the user types within the text box portion of the combo box. OnCloseUp - Occurs when the drop-down portion of the combo box is closed. OnDropDown - Occurs when the drop-down portion of the combo box is displayed. OnKillFocus - Occurs when the combo box loses the focus. OnSelCancel - Occurs when the drop down list of the combo box is triggered, but the user does not select a value. Also occurs when the combo box

Page 11 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 12: Formulario arcpad

loses focus. OnSelChange - Occurs when the selection within the combo box is changed. OnSelOK - Occurs when an item is selected from the list in the combo box. OnSetFocus - Occurs when the combo box gets the focus. OnValidate - Occurs when the combo box is validated.

Properties ComboBox control properties can be read and set at run-time via scripts. The following ComboBox control properties are available:

DefaultValue - Returns or sets the default value expression for the combo box. Enabled - Returns or sets a value that determines if the combo box is enabled. Field - Returns a reference to the feature attribute field to which the combo box is bound. hWnd - Returns the window handle of the combo box. Index - Returns the index of the combo box. ListCount - Returns the number of items in the list for the combo box. ListIndex - Returns or sets the index of the currently selected item in the combo box. Name - Returns the name of the combo box. Parent - Returns a reference to the page that contains the combo box. Properties - Returns the value of the specified property for the combo box. Text - Returns the text of the item currently displayed in the combo box. Type - Returns the type of the control ("COMBOBOX" for a combo box). Value - Returns the value of the item currently displayed in the combo box. Visible - Returns or sets a value that determines whether the combo box is visible.

Methods ComboBox control methods can be called at run-time via scripts. The following ComboBox control methods are available:

SetFocus - Sets the focus to the combo box. AddItem - Adds an item to the combo box. AddItemsFromTable - Adds items from a DBF table to the combo box. Clear - Clears the contents of the combo box. RemoveItem - Removes an item from the combo box.

Getting a reference to a ComboBox control You can only reference a ComboBox control in a form that is currently displayed. Attempting to reference a ComboBox control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a ComboBox control:

Direct reference This involves referencing a ComboBox control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a ComboBox control with the name "cboPoleType" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheComboBox Set pTheComboBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("cboPoleType")

JScript

var pTheComboBox; pTheComboBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("cboPoleType");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same ComboBox control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheComboBox Set pTheComboBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("cboPoleType")

JScript

var pTheComboBox; pTheComboBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("cboPoleType");

Event reference This involves referencing a ComboBox control in an event handling script. For example, to reference a ComboBox control in its OnSelChange event handler, you would use the code:

VBScript

Dim pTheComboBox Set pTheComboBox = ThisEvent.Object

JScript

var pTheComboBox; pTheComboBox = ThisEvent.Object;

To reference a ComboBox control with the name "cboPoleType" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheComboBox Set pTheComboBox = ThisEvent.Object.Pages("pgPage1").Controls("cboPoleType")

JScript

var pTheComboBox; pTheComboBox = ThisEvent.Object.Pages("pgPage1").Controls("cboPoleType");

Initializing a ComboBox control

Page 12 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 13: Formulario arcpad

Combo box initialization involves setting particular combo box properties when the combo box is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would display a combo box with the name "cboPoleType" with no item selected when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("cboPoleType").ListIndex = -1

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls; pTheControls("cboPoleType").ListIndex = -1;

Text vs. Value in a ComboBox control Items displayed in a combo box have two components: the text (which can be read with the Text property) and the value (which can be read with the Value property). The text is what gets displayed to the user, while the value is what gets stored in the attribute associated with the ComboBox control (if there is one). At design-time, you specify the value and text of combo box items by clicking the List Items button in the Control Properties page of the Form Editor dialog box. At run-time, you specify the value and text of combo box items when using the AddItem or AddItemsFromTable methods. The value and text can be the same for a combo box item, but you still need to specify both.

Selecting an item in a ComboBox control To select an item in a combo box at run-time, you set its ListIndex property to the index of the desired list item. For example, to select the third list item in a combo box referenced by the variable pTheComboBox, use the following code:

VBScript

pTheComboBox.ListIndex = 2

JScript

pTheComboBox.ListIndex = 2;

Populating and unpopulating a ComboBox control There are several ways to populate and unpopulate a combo box at run-time. Use the AddItem method to add items one by one to a combo box. Or, you can add multiple items from a DBF table to a combo box by using the AddItemsFromTable method. Use the RemoveItem method to remove items one by one from a combo box . Or, you can clear the entire contents of the combo box by using the Clear method. For example, the following code clears the original contents of the combo box referenced by the variable pTheComboBox, and then populates the combo box with several new items:

VBScript

pTheComboBox.Clear pTheComboBox.AddItem "BP2","2 inch brass pipe" pTheComboBox.AddItem "BP3","3 inch brass pipe" pTheComboBox.AddItem "CP2","2 inch copper pipe" pTheComboBox.AddItem "CP3","3 inch copper pipe"

JScript

pTheComboBox.Clear(); pTheComboBox.AddItem ("BP2","2 inch brass pipe"); pTheComboBox.AddItem ("BP3","3 inch brass pipe"); pTheComboBox.AddItem ("CP2","2 inch copper pipe"); pTheComboBox.AddItem ("CP3","3 inch copper pipe");

Using DateTime Controls

See Also

Use a DateTime control to provide a formatted date field that allows easy date selection. In addition, the DateTime control displays a dropdown calender that can be used to select a date.

DateTime controls are represented by Control objects in the ArcPad object model and by DATETIME elements in ArcPad XML.

Attributes DateTime control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the DateTime control. Used to reference the DateTime control in scripts. width - The width of the control. height - The height of the control. x - The x coordinate of the upper left corner of the control. y - The y coordinate of the upper left corner of the control. sip - Specifies if the SIP (soft input panel) is displayed on pen devices when the control gets the focus. required - Specifies if the user must select a date for the control. allownulls - Specifies whether the control can accept a null value. defaultvalue - A simple expression that specifies the default value of the control. tabstop - Specifies whether the TAB key can be used to move the focus to the control. group - Specifies whether the control starts a new group of controls. border - Specifies whether the control has a border. readonly - Specifies whether the control's value can be modified by the user. field - The field of the shapefile's DBF table that is linked to the control. backgroundcolor - The background color to use for the control. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the control's text. If not specified, this value is inherited from the page's color attribute.

Page 13 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 14: Formulario arcpad

font - The font to use for the control's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the control's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the control's text. If not specified, this value is inherited from the page's fontstyle attribute. onchange - The script to run when an OnChange event occurs. oncloseup - The script to run when an OnCloseUp event occurs. ondropdown - The script to run when an OnDropDown event occurs. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events DateTime controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following DateTime control events are available:

OnChange - Occurs when the user selects a date in the control. OnCloseUp - Occurs when the drop-down calender closed. OnDropDown - Occurs when the drop-down calender is displayed. OnKillFocus - Occurs when the control loses the focus. OnSetFocus - Occurs when the control gets the focus. OnValidate - Occurs when the control is validated.

Properties DateTime control properties can be read and set at run-time via scripts. The following DateTime control properties are available:

DefaultValue - Returns or sets the default value expression for the control. Enabled - Returns or sets a value that determines if the control is enabled. Field - Returns a reference to the feature attribute field to which the control is bound. hWnd - Returns the window handle of the control. Index - Returns the index of the control. Name - Returns the name of the control. Parent - Returns a reference to the page that contains the control. Text - Returns the date currently displayed in the control. Type - Returns the type of the control ("DATETIME" for a DateTime control). Value - Returns the date currently displayed in the control. Visible - Returns or sets a value that determines whether the control is visible.

Methods DateTime control methods can be called at run-time via scripts. The following DateTime control methods are available:

SetFocus - Sets the focus to the control.

Getting a reference to a DateTime control You can only reference a DateTime control in a form that is currently displayed. Attempting to reference a DateTime control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a DateTime control:

Direct reference This involves referencing a DateTime control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a DateTime control with the name "dtDateAdded" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheDateTime Set pTheDateTime = Applet.Forms("frmSettings").Pages("pgPage1").Controls("dtDateAdded")

JScript

var pTheDateTime; pTheDateTime = Applet.Forms("frmSettings").Pages("pgPage1").Controls("dtDateAdded");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same DateTime control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheDateTime Set pTheDateTime = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("dtDateAdded")

JScript

var pTheDateTime; pTheDateTime = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("dtDateAdded");

Event reference This involves referencing a DateTime control in an event handling script. For example, to reference a DateTime control in its OnChange event handler, you would use the code:

VBScript

Dim pTheDateTime Set pTheDateTime = ThisEvent.Object

JScript

var pTheDateTime; pTheDateTime = ThisEvent.Object;

To reference a DateTime control with the name "dtDateAdded" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheDateTime

Page 14 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 15: Formulario arcpad

Set pTheDateTime = ThisEvent.Object.Pages("pgPage1").Controls("dtDateAdded")

JScript

var pTheDateTime; pTheDateTime = ThisEvent.Object.Pages("pgPage1").Controls("dtDateAdded");

Initializing a DateTime control DateTime control initialization involves setting particular DateTime properties when the control is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would display a DateTime control with the name "dtDateAdded" with today's date when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("dtDateAdded").Value = Now

JScript

var pTheControls, dtDate, strToday; pTheControls = ThisEvent.Object.Controls; dtDate = new Date(); strToday = (dtDate.getMonth() + 1) + "/"; strToday += dtDate.getDate() + "/"; strToday += dtDate.getYear(); pTheControls("dtDateAdded").Value = strToday;

The following code would display a DateTime control with the name "dtDateAdded" with the date April 20th, 2001 when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("dtDateAdded").Value = CDate(#04/20/2001#)

JScript

var pTheControls, dtDate; pTheControls = ThisEvent.Object.Controls; dtDate = new Date("4/20/2001"); pTheControls("dtDateAdded").Value = dtDate.getVarDate();

Using DomainField Controls

See Also

Use a DomainField control when you have a field with a subtype, coded value domain, or range domain in an ArcPad AXF file layer and you want ArcPad to automatically restrict the control to valid values from the subtype or domain. The DomainField control also automatically switches between different domains (that is, no domain, range domain, or coded value domain) when governed by a subtype field associated with another DomainField control. DomainField controls can only be added to layer forms (Edit, Identify, or Query).

DomainField controls are represented by Control objects in the ArcPad object model and by DOMAINFIELD elements in ArcPad XML.

Although DomainField controls expose properties, methods, and events to the ArcPad Object Model, it is not expected that you will customize these controls. DomainFields are highly automated controls that work directly with the database schema to ensure validation for a particular field.

Attributes DomainField control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the layer definition in ArcPad XML format.

name - The name of the DomainField control. Used to reference the DomainField control in scripts. width - The width of the control. height - The height of the control. x - The x coordinate of the upper left corner of the control. y - The y coordinate of the upper left corner of the control. sip - Specifies if the SIP (soft input panel) is displayed on pen devices when the control gets the focus. required - Specifies if the user must select an item in the control. defaultvalue - A simple expression that specifies the default value of the control. group - Specifies whether the DomainField control starts a new group of controls. border - Specifies whether the control has a border. tabstop - Specifies whether the TAB key can be used to move the focus to the control. readonly - Specifies whether the control's value can be modified by the user. field - The field of the layer that is linked to the DomainField control. sort -Specifies if the items in the control are automatically sorted alphabetically. backgroundcolor - The background color to use for the control. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the control's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the control's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the control's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the control's text. If not specified, this value is inherited from the page's fontstyle attribute. onchange - The script to run when an OnChange event occurs. oncloseup - The script to run when an OnCloseUp event occurs. ondropdown - The script to run when an OnDropDown event occurs. onselchange - The script to run when an OnSelChange event occurs. onselcancel - The script to run when an OnSelCancel event occurs. onselok - The script to run when an OnSelOK event occurs. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs.

Page 15 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 16: Formulario arcpad

onvalidate - The script to run when an OnValidate event occurs.

Events DomainField controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following DomainField control events are available, however it is not recommended that you write event handler script code for DomainField controls, except in specialized cases. DomainField is a highly automated control that works directly with the database schema to ensure validation for a particular field:

OnChange - Occurs when the user types within the text box portion of the domain field. OnCloseUp - Occurs when the drop-down portion of the domain field is closed. OnDropDown - Occurs when the drop-down portion of the domain field is displayed. OnKillFocus - Occurs when the domain field loses the focus. OnSelCancel - Occurs when the drop down list of the domain field is triggered, but the user does not select a value. Also occurs when the domain field loses focus. OnSelChange - Occurs when the selection within the domain field is changed. OnSelOK - Occurs when an item is selected from the list in the domain field. OnSetFocus - Occurs when the domain field gets the focus. OnValidate - Occurs when the domain field is validated.

Properties DomainField control properties can be read and set at run-time via scripts. The following DomainField control properties are available, however it is not recommended that you write script code for DomainField controls, except in specialized cases. DomainField is a highly automated control that works directly with the database schema to ensure validation for a particular field:

DefaultValue - Returns or sets the default value expression for the domain field. Enabled - Returns or sets a value that determines if the domain field is enabled. Field - Returns a reference to the feature attribute field to which the domain field is bound. hWnd - Returns the window handle of the domain field. Index - Returns the index of the domain field. ListCount - Returns the number of items in the list for the domain field. ListIndex - Returns or sets the index of the currently selected item in the domain field. Name - Returns the name of the domain field. Parent - Returns a reference to the page that contains the domain field. Properties - Returns the value of the specified property for the domain field. Text - Returns the text of the item currently displayed in the domain field. Type - Returns the type of the control ("DOMAINFIELD" for a domain field). Value - Returns the value of the item currently displayed in the domain field. Visible - Returns or sets a value that determines whether the domain field is visible.

Methods DomainField control methods can be called at run-time via scripts. The following DomainField control methods are available, however it is not recommended that you write script code for DomainField controls, except in specialized cases. DomainField is a highly automated control that works directly with the database schema to ensure validation for a particular field:

SetFocus - Sets the focus to the domain field.

Getting a reference to a DomainField control You can only reference a DomainField control in a form that is currently displayed. Attempting to reference a DomainField control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a DomainField control:

Direct reference This involves referencing a DomainField control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a DomainField control with the name "dfPoleType" on a page with the name "pgPage1" in an edit form with the name "EDITFORM" that is present in a layer with the name "Poles", you would use the code:

VBScript

Dim pTheDomainField Set pTheDomainField = Layer.Forms("EDITFORM").Pages("pgPage1").Controls("dfPoleType")

JScript

var pTheDomainField; pTheDomainField = Layer.Forms("EDITFORM").Pages("pgPage1").Controls("dfPoleType");

The above code assumes that it is present in the layer definition itself. If you need to reference the same DomainField control from a different layer definition, or other customization file, you need to explicitly reference the layer definition. For example:

VBScript

Dim pTheDomainField Set pTheDomainField = Application.Map.Layers("Poles").Forms("EDITFORM").Pages("pgPage1").Controls("dfPoleType")

JScript

var pTheDomainField; pTheDomainField = Application.Map.Layers("Poles").Forms("EDITFORM").Pages("pgPage1").Controls("dfPoleType");

Event reference This is the recommended approach. It involves referencing a DomainField control in an event handling script. For example, to reference a DomainField control in its OnSelChange event handler, you would use the code:

VBScript

Dim pTheDomainField Set pTheDomainField = ThisEvent.Object

JScript

var pTheDomainField; pTheDomainField = ThisEvent.Object;

Page 16 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 17: Formulario arcpad

To reference a DomainField control with the name "dfPoleType" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheDomainField Set pTheDomainField = ThisEvent.Object.Pages("pgPage1").Controls("dfPoleType")

JScript

var pTheDomainField; pTheDomainField = ThisEvent.Object.Pages("pgPage1").Controls("dfPoleType");

Text vs. Value in a DomainField control Items displayed in a domain field have two components: the text (which can be read with the Text property) and the value (which can be read with the Value property). The text is what gets displayed to the user, while the value is what gets stored in the attribute associated with the DomainField control.

Selecting an item in a DomainField control To select an item in a domain field at run-time, you set its ListIndex property to the index of the desired list item. For example, to select the third list item in a domain field referenced by the variable pTheDomainField, use the following code:

VBScript

pTheDomainField.ListIndex = 2

JScript

pTheDomainField.ListIndex = 2;

Using Edit Controls

See Also

Use an Edit control to display text entered at design-time, by the user, or assigned to the control in code at run time. An Edit control is also commonly called a text box.

Edit controls are represented by Control objects in the ArcPad object model and by EDIT elements in ArcPad XML.

Attributes Edit control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the Edit control. Used to reference the Edit control in scripts. width - The width of the text box. height - The height of the text box. x - The x coordinate of the upper left corner of the text box. y - The y coordinate of the upper left corner of the text box. alignment - The alignment of the text box's text. autoincrement - Specifies whether the value of the text box's bound, numeric field will automatically increment when a new feature is added. autoincrementstep - Specifies the autoincrement step value. tabstop - Specifies whether the TAB key can be used to move the focus to the text box. group - Specifies whether the text box starts a new group of controls. border - Specifies whether the text box has a border. multiline - Specifies if the text box contains multiple lines of text. defaultvalue - A simple expression that specifies the default value of the text box. sip - Specifies if the SIP (soft input panel) is displayed on pen devices when the text box gets the focus. hscroll - Specifies if the text box should have a horizontal scroll bar. vscroll - Specifies if the text box should have a vertical scroll bar. required - Specifies if the user must enter some text in the text box. readonly - Specifies whether the text box's value can be modified by the user. password - Specifies if the characters displayed in the text box are replaced by asterisks (*). uppercase - Specifies if the characters displayed in the text box are all uppercase. lowercase - Specifies if the characters displayed in the text box are all lowercase. field - The field of the shapefile's DBF table that is linked to the text box. backgroundcolor - The background color to use for the text box. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the text box's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the text box's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the text box's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the text box's text. If not specified, this value is inherited from the page's fontstyle attribute. maxvalue - Specifies the maximum value allowed for the text box. This can be a numeric or text value. minvalue - Specifies the minimum value allowed for the text box. This can be a numeric or text value. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onchange - The script to run when an OnChange event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events Edit controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following Edit control events are available:

OnChange - Occurs when the text in the text box is modified. OnKillFocus - Occurs when the text box loses the focus. OnSetFocus - Occurs when the text box gets the focus. OnValidate - Occurs when the text box is validated.

Page 17 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 18: Formulario arcpad

Properties Edit control properties can be read and set at run-time via scripts. The following Edit control properties are available:

DefaultValue - Returns or sets the default value expression for the text box. Enabled - Returns or sets a value that determines if the text box is enabled. Field - Returns a reference to the feature attribute field to which the text box is bound. hWnd - Returns the window handle of the text box. Index - Returns the index of the text box. Name - Returns the name of the text box. Parent - Returns a reference to the page that contains the text box. Text - Returns or sets the text displayed in the text box. Type - Returns the type of the control ("EDIT" for a text box). Value - Returns or sets the value that is displayed in the text box. Visible - Returns or sets a value that determines whether the text box is visible.

Methods Edit control methods can be called at run-time via scripts. The following Edit control methods are available:

SetFocus - Sets the focus to the text box.

Getting a reference to a Edit control You can only reference a Edit control in a form that is currently displayed. Attempting to reference a Edit control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a Edit control:

Direct reference This involves referencing a Edit control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a Edit control with the name "txtName" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheEdit Set pTheEdit = Applet.Forms("frmSettings").Pages("pgPage1").Controls("txtName")

JScript

var pTheEdit; pTheEdit = Applet.Forms("frmSettings").Pages("pgPage1").Controls("txtName");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same Edit control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheEdit Set pTheEdit = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("txtName")

JScript

var pTheEdit; pTheEdit = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("txtName");

Event reference This involves referencing a Edit control in an event handling script. For example, to reference a Edit control in its OnChange event handler, you would use the code:

VBScript

Dim pTheEdit Set pTheEdit = ThisEvent.Object

JScript

var pTheEdit; pTheEdit = ThisEvent.Object;

To reference a Edit control with the name "txtName" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheEdit Set pTheEdit = ThisEvent.Object.Pages("pgPage1").Controls("txtName")

JScript

var pTheEdit; pTheEdit = ThisEvent.Object.Pages("pgPage1").Controls("txtName");

Initializing a Edit control Text box initialization involves setting particular text box properties when the text box is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would disable a text box with the name "txtName" when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("txtName").Enabled = False

JScript

var pTheControls;

Page 18 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 19: Formulario arcpad

pTheControls = ThisEvent.Object.Controls ; pTheControls("txtName").Enabled = false;

Specifying the text displayed in an Edit control To set the text displayed in a text box at run-time, you set its Value property to the desired text string. For example, to display the text "Hello World" in a text box referenced by the variable pTheEdit, use the following code:

VBScript

pTheEdit.Value = "Hello World"

JScript

pTheEdit.Value = "Hello World";

Using ImageBox Controls

See Also

Use an ImageBox control to display a graphic. An image box can display a graphic from a JPEG (.jpg), Mr.SID (.sid), or bitmap (.bmp) file.

ImageBox controls are represented by Control objects in the ArcPad object model and by IMAGEBOX elements in ArcPad XML.

Attributes ImageBox control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the ImageBox control. Used to reference the ImageBox control in scripts. width - The width of the image box. height - The height of the image box. x - The x coordinate of the upper left corner of the image box. y - The y coordinate of the upper left corner of the image box. clickaction - The action taken when the user taps the image box. defaultvalue - A simple expression that specifies the default value of the image box. required - Specifies if the user must select an image in the image box. readonly - Specifies whether the image box's value can be modified by the user. tabstop - Specifies whether the TAB key can be used to move the focus to the image box. group - Specifies whether the image box starts a new group of controls. border - Specifies whether the image box has a border. field - The field of the shapefile's DBF table that is linked to the image box. onchange - The script to run when an OnChange event occurs. onclick - The script to run when an OnClick event occurs.

Events ImageBox controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following ImageBox control events are available:

OnClick - Occurs when the image box is clicked. OnChange - Occurs when a new image is placed in an ImageBox control (via selecting a file or using the camera).

Properties ImageBox control properties can be read and set at run-time via scripts. The following ImageBox control properties are available:

DefaultValue - Returns or sets the default value expression for the image box. Enabled - Returns or sets a value that determines if the image box is enabled. Field - Returns a reference to the feature attribute field to which the image box is bound. hWnd - Returns the window handle of the image box. Index - Returns the index of the image box. Name - Returns the name of the image box. Parent - Returns a reference to the page that contains the image box. Type - Returns the type of the control ("IMAGEBOX" for a image box). Value - Returns or sets the complete file path of the image that is displayed in the image box. Visible - Returns or sets a value that determines whether the image box is visible.

Methods ImageBox controls do not support any methods.

Getting a reference to an ImageBox control You can only reference an ImageBox control in a form that is currently displayed. Attempting to reference an ImageBox control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing an ImageBox control:

Direct reference This involves referencing an ImageBox control via its name, its page's name, its form's name, and its form's parent object. For example, to reference an ImageBox control with the name "imgLogo" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheImageBox Set pTheImageBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("imgLogo")

JScript

var pTheImageBox; pTheImageBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("imgLogo");

Page 19 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 20: Formulario arcpad

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same ImageBox control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheImageBox Set pTheImageBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("imgLogo")

JScript

var pTheImageBox; pTheImageBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("imgLogo");

Event reference This involves referencing an ImageBox control in an event handling script. For example, to reference an ImageBox control with the name "imgLogo" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheImageBox Set pTheImageBox = ThisEvent.Object.Pages("pgPage1").Controls("imgLogo")

JScript

var pTheImageBox; pTheImageBox = ThisEvent.Object.Pages("pgPage1").Controls("imgLogo");

Initializing a ImageBox control Image box initialization involves setting particular image box properties when the image box is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would hide an image box with the name "imgLogo" when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("imgLogo").Visible = False

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls; pTheControls("imgLogo").Visible = false;

Specifying the image displayed in an ImageBox control To set the image displayed in an image box at run-time, you set its Value property to the desired image file's file path. For example, to display the bitmap image "c:\images\logo.bmp" in an image box referenced by the variable pTheImageBox, use the following code:

VBScript

pTheImageBox.Value = "c:\images\logo.bmp"

JScript

pTheImageBox.Value = "c:\images\logo.bmp";

Using Label Controls

See Also

Use a Label control to display text that a user can't change directly.

Label controls are represented by Control objects in the ArcPad object model and by LABEL elements in ArcPad XML.

Attributes Label control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the Label control. Used to reference the Label control in scripts. width - The width of the label. height - The height of the label. x - The x coordinate of the upper left corner of the label. y - The y coordinate of the upper left corner of the label. alignment - The alignment of the label's caption. caption - The text displayed for the label. group - Specifies whether the label starts a new group of controls. border - Specifies whether the label has a border. backgroundcolor - The background color to use for the label. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the label's text. If not specified, this value is inherited from the page's color attribute. font - The font for the label. If not specified, this value is inherited from the page's font attribute. fontsize - The font size for the label. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style for the label. If not specified, this value is inherited from the page's fontstyle attribute.

Events Label controls do not generate any events.

Properties Label control properties can be read and set at run-time via scripts. The following Label control properties are available:

Page 20 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 21: Formulario arcpad

Enabled - Returns or sets a value that determines if the label is enabled. hWnd - Returns the window handle of the label. Index - Returns the index of the label. Name - Returns the name of the label. Parent - Returns a reference to the page that contains the label. Text - Returns or sets the text that is displayed for the label. Type - Returns the type of the control ("LABEL" for a label). Value - Returns or sets the text that is displayed for the label. Visible - Returns or sets a value that determines whether the label is visible.

Methods Label controls do not support any methods.

Getting a reference to a Label control You can only reference a Label control in a form that is currently displayed. Attempting to reference a Label control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a Label control:

Direct reference This involves referencing a Label control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a Label control with the name "lblConfigure" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheLabel Set pTheLabel = Applet.Forms("frmSettings").Pages("pgPage1").Controls("lblConfigure")

JScript

var pTheLabel; pTheLabel = Applet.Forms("frmSettings").Pages("pgPage1").Controls("lblConfigure");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same Label control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheLabel Set pTheLabel = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("lblConfigure")

JScript

var pTheLabel; pTheLabel = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("lblConfigure");

Event reference This involves referencing a Label control in an event handling script. For example, to reference a Label control with the name "lblConfigure" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheLabel Set pTheLabel = ThisEvent.Object.Pages("pgPage1").Controls("lblConfigure")

JScript

var pTheLabel; pTheLabel = ThisEvent.Object.Pages("pgPage1").Controls("lblConfigure");

Initializing a Label control Label initialization involves setting particular label properties when the label is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would hide a label with the name "lblConfigure" when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("lblConfigure").Visible = False

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls; pTheControls("lblConfigure").Visible = false;

Specifying the text displayed in a Label control To set the text displayed in a label at run-time, you set its Value property to the desired text string. For example, to display the text "Configure" in a label referenced by the variable objTheLabel, use the following code:

VBScript

pTheLabel.Value = "Configure"

JScript

pTheLabel.Value = "Configure";

Using ListBox Controls

See Also

Page 21 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 22: Formulario arcpad

Use a ListBox control to provide a list of choices from which the user can select one.

ListBox controls are represented by Control objects in the ArcPad object model and by LISTBOX elements in ArcPad XML.

Attributes ListBox control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the ListBox control. Used to reference the ListBox control in scripts. width - The width of the list box. height - The height of the list box. x - The x coordinate of the upper left corner of the list box. y - The y coordinate of the upper left corner of the list box. required - Specifies if the user must select an item in the list box. defaultvalue - A simple expression that specifies the default value of the list box. tabstop - Specifies whether the TAB key can be used to move the focus to the list box. group - Specifies whether the list box starts a new group of controls. border - Specifies whether the list box has a border. readonly - Specifies whether the list box's value can be modified by the user. hscroll - Specifies if the list box should have a horizontal scroll bar. vscroll - Specifies if the list box should have a vertical scroll bar. listtable - The DBF table used to populate the list box. listvaluefield - The field of the DBF table that contains the data used to populate the value component of the list box's items. listtextfield - The field of the DBF table that contains the data used to populate the text component of the list box's items. field - The field of the shapefile's DBF table that is linked to the list box. sort - Specifies if the items in the list box are automatically sorted alphabetically. showvalues - Specifies if the values are displayed next to the text for items in the list box. backgroundcolor - The background color to use for the list box. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the list box's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the list box's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the list box's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the list box's text. If not specified, this value is inherited from the page's fontstyle attribute. onselchange - The script to run when an OnSelChange event occurs. onselcancel - The script to run when an OnSelCancel event occurs. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events ListBox controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following ListBox control events are available:

OnKillFocus - Occurs when the list box loses the focus. OnSelCancel - Occurs when the list box loses focus. OnSelChange - Occurs when the selection within the list box is changed. OnSetFocus - Occurs when the list box gets the focus. OnValidate - Occurs when the list box is validated.

Properties ListBox control properties can be read and set at run-time via scripts. The following ListBox control properties are available:

DefaultValue - Returns or sets the default value expression for the list box. Enabled - Returns or sets a value that determines if the list box is enabled. Field - Returns a reference to the feature attribute field to which the list box is bound. hWnd - Returns the window handle of the list box. Index - Returns the index of the list box. ListCount - Returns the number of items in the list for the list box. ListIndex - Returns or sets the index of the currently selected item in the list box. Name - Returns the name of the list box. Parent - Returns a reference to the page that contains the list box. Properties - Returns the value of the specified property for the list box. Text - Returns the text of the item currently displayed in the list box. Type - Returns the type of the control ("LISTBOX" for a list box). Value - Returns the value of the item currently displayed in the list box. Visible - Returns or sets a value that determines whether the list box is visible.

Methods ListBox control methods can be called at run-time via scripts. The following ListBox control methods are available:

SetFocus - Sets the focus to the list box. AddItem - Adds an item to the list box. AddItemsFromTable - Adds items from a DBF table to the list box. Clear - Clears the contents of the list box. RemoveItem - Removes an item from the list box.

Getting a reference to a ListBox control You can only reference a ListBox control in a form that is currently displayed. Attempting to reference a ListBox control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a ListBox control:

Direct reference This involves referencing a ListBox control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a ListBox control with the name "lboStreetType" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Page 22 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 23: Formulario arcpad

Dim pTheListBox Set pTheListBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("lboStreetType")

JScript

var pTheListBox; pTheListBox = Applet.Forms("frmSettings").Pages("pgPage1").Controls("lboStreetType");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same ListBox control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheListBox Set pTheListBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("lboStreetType")

JScript

var pTheListBox; pTheListBox = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("lboStreetType");

Event reference This involves referencing a ListBox control in an event handling script. For example, to reference a ListBox control in its OnSelChange event handler, you would use the code:

VBScript

Dim pTheListBox Set pTheListBox = ThisEvent.Object

JScript

var pTheListBox; pTheListBox = ThisEvent.Object;

To reference a ListBox control with the name "lboStreetType" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheListBox Set pTheListBox = ThisEvent.Object.Pages("pgPage1").Controls("lboStreetType")

JScript

var pTheListBox; pTheListBox = ThisEvent.Object.Pages("pgPage1").Controls("lboStreetType");

Initializing a ListBox control List box initialization involves setting particular list box properties when the list box is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would display a list box with the name "lboStreetType" with no item selected when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("lboStreetType").ListIndex = -1

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls ; pTheControls("lboStreetType").ListIndex = -1;

Text vs. Value in a ListBox control Items displayed in a list box have two components: the text (which can be read with the Text property) and the value (which can be read with the Value property). The text is what gets displayed to the user, while the value is what gets stored in the attribute associated with the ListBox control (if there is one). At design-time, you specify the value and text of list box items by clicking the List Items button in the Control Properties page of the Form Editor dialog box. At run-time, you specify the value and text of list box items when using the AddItem or AddItemsFromTable methods. The value and text can be the same for a list box item, but you still need to specify both.

Selecting an item in a ListBox control To select an item in a list box at run-time, you set its ListIndex property to the index of the desired list item. For example, to select the third list item in a list box referenced by the variable pTheListBox, use the following code:

VBScript

pTheListBox.ListIndex = 2

JScript

pTheListBox.ListIndex = 2;

Populating and unpopulating a ListBox control There are several ways to populate and unpopulate a list box at run-time. Use the AddItem method to add items one by one to a list box. Or, you can add multiple items from a DBF table to a list box by using the AddItemsFromTable method. Use the RemoveItem method to remove items one by one from a list box . Or, you can clear the entire contents of the list box by using the Clear method. For example, the following code clears the original contents of the list box referenced by the variable objTheListBox, and then populates the list box with several new items:

VBScript

pTheListBox.Clear pTheListBox.AddItem "BP2","2 inch brass pipe"

Page 23 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 24: Formulario arcpad

pTheListBox.AddItem "BP3","3 inch brass pipe" pTheListBox.AddItem "CP2","2 inch copper pipe" pTheListBox.AddItem "CP3","3 inch copper pipe"

JScript

pTheListBox.Clear (); pTheListBox.AddItem ("BP2","2 inch brass pipe"); pTheListBox.AddItem ("BP3","3 inch brass pipe"); pTheListBox.AddItem ("CP2","2 inch copper pipe"); pTheListBox.AddItem ("CP3","3 inch copper pipe");

Using RadioButton Controls

See Also

Use RadioButton controls to present mutually exclusive options. When one radio button is selected in a group, the previously selected radio button is deselected, so only one of the options in the group is selected at a time. When a RadioButton control is associated with an attribute field, the value of the selected radio button is written to the associated attribute field.

RadioButton controls are represented by Control objects in the ArcPad object model and by RADIOBUTTON elements in ArcPad XML.

Attributes RadioButton control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the RadioButton control. Used to reference the RadioButton control in scripts. width - The width of the radio button. height - The height of the radio button. x - The x coordinate of the upper left corner of the radio button. y - The y coordinate of the upper left corner of the radio button. tabstop - Specifies whether the TAB key can be used to move the focus to the radio button. group - Specifies whether the radio button starts a new group of controls. border - Specifies whether the radio button has a border. caption - The caption displayed to the right of the radio button. required - Specifies if the user must select the radio button. field - The field of the shapefile's DBF table that is linked to the radio button. readonly - Specifies whether the radio button's value can be modified by the user. value - The value that is written to the linked field when the radio button is selected. backgroundcolor - The background color to use for the radio button. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the radio button's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the radio button's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the radio button's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the radio button's text. If not specified, this value is inherited from the page's fontstyle attribute. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs. onclick - The script to run when an OnClick event occurs. onvalidate - The script to run when an OnValidate event occurs.

Events RadioButton controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following RadioButton control events are available:

OnClick - Occurs when the user clicks the radio button. OnKillFocus - Occurs when the radio button loses the focus. OnSetFocus - Occurs when the radio button gets the focus. OnValidate - Occurs when the radio button is validated.

Properties RadioButton control properties can be read and set at run-time via scripts. The following RadioButton control properties are available:

Enabled - Returns or sets a value that determines if the radio button is enabled. Field - Returns a reference to the feature attribute field to which the radio button is bound. hWnd - Returns the window handle of the radio button. Index - Returns the index of the radio button. Name - Returns the name of the radio button. Parent - Returns a reference to the page that contains the radio button. Text - Returns or sets the text displayed to the right of the radio button. Type - Returns the type of the control ("RADIOBUTTON" for a radio button). Value - Returns or sets a value that determines whether the radio button is selected or unselected. Visible - Returns or sets a value that determines whether the radio button is visible.

Methods RadioButton control methods can be called at run-time via scripts. The following RadioButton control methods are available:

SetFocus - Sets the focus to the radio button.

Getting a reference to a RadioButton control You can only reference a RadioButton control in a form that is currently displayed. Attempting to reference a RadioButton control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a RadioButton control:

Direct reference This involves referencing a RadioButton control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a RadioButton control with the name "rdoValue1" on a page with the name "pgPage1" in a form with the name "frmSettings" that is

Page 24 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 25: Formulario arcpad

present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheRadioButton Set pTheRadioButton = Applet.Forms("frmSettings").Pages("pgPage1").Controls("rdoValue1")

JScript

var pTheRadioButton; pTheRadioButton = Applet.Forms("frmSettings").Pages("pgPage1").Controls("rdoValue1");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same RadioButton control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheRadioButton Set pTheRadioButton = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("rdoValue1")

JScript

var pTheRadioButton; pTheRadioButton = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("rdoValue1");

Event reference This involves referencing a RadioButton control in an event handling script. For example, to reference a RadioButton control in its OnClick event handler, you would use the code:

VBScript

Dim pTheRadioButton Set pTheRadioButton = ThisEvent.Object

JScript

var pTheRadioButton; pTheRadioButton = ThisEvent.Object;

To reference a RadioButon control with the name "rdoValue1" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheRadioButton Set pTheRadioButton = ThisEvent.Object.Pages("pgPage1").Controls("rdoValue1")

JScript

var pTheRadioButton; pTheRadioButton = ThisEvent.Object.Pages("pgPage1").Controls("rdoValue1");

Initializing a RadioButton control Radio button initialization involves setting particular radio button properties when the radio button is first displayed. Generally, the OnLoad event handler of the page or form is the most appropriate place to do this. For example, the following code would disable a radio button with the name "rdoValue1" when called in the page's OnLoad event handler:

VBScript

Dim pTheControls Set pTheControls = ThisEvent.Object.Controls pTheControls("rdoValue1").Enabled = False

JScript

var pTheControls; pTheControls = ThisEvent.Object.Controls ; pTheControls("rdoValue1").Enabled = false;

Using Slider Controls

See Also

Use a Slider control to allow users to select a discrete number or a set of consecutive numbers in a range in an associated Edit control. The number stays within the range of the Slider control. The associated Edit control is known as a buddy. When you add a Slider and its buddy Edit control to a form, make sure the controls are positioned such that the buddy Edit control is placed to the left of the Slider control on the same line of the form. Otherwise, the buddy Edit control will be automatically repositioned and possibly truncated off the form.

Slider controls are represented by Control objects in the ArcPad object model and by SLIDER elements in ArcPad XML.

Attributes Slider control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the Slider control. Used to reference the Slider control in scripts. width - The width of the slider. height - The height of the slider. x - The x coordinate of the upper left corner of the slider. y - The y coordinate of the upper left corner of the slider. tabstop - Specifies whether the TAB key can be used to move the focus to the slider. group - Specifies whether the slider starts a new group of controls.

Page 25 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 26: Formulario arcpad

border - Specifies whether the slider has a border. readonly - Specifies whether the slider's value can be modified by the user. required - Specifies if the user must select a value with the slider. defaultvalue - A simple expression that specifies the default value of the slider. orientation - The orientation of the slider (horizontal or vertical). lower - The minimum number in the range of the slider. upper - The maximum number in the range of the slider. buddy - The Edit control that is associated with the Slider control. field - The field of the shapefile's DBF table that is linked to the slider.

Events Slider controls do not generate any events.

Properties Slider control properties can be read and set at run-time via scripts. The following Slider control properties are available:

DefaultValue - Returns or sets the default value expression for the slider. Enabled - Returns or sets a value that determines if the control is enabled. hWnd - Returns the window handle of the control. Index - Returns the index of the control. Name - Returns the name of the control. Parent - Returns a reference to the page that contains the control. Type - Returns the type of the control ("SLIDER" for a slider). Value - Returns or sets the value of the control. Visible - Returns or sets a value that determines whether the control is visible.

Methods Slider controls do not support any methods.

Getting a reference to a Slider control You can only reference a Slider control in a form that is currently displayed. Attempting to reference a Slider control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a Slider control:

Direct reference This involves referencing a Slider control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a Slider control with the name "sldWidth" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheSlider Set pTheSlider = Applet.Forms("frmSettings").Pages("pgPage1").Controls("sldWidth")

JScript

var pTheSlider; pTheSlider = Applet.Forms("frmSettings").Pages("pgPage1").Controls("sldWidth");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same Slider control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheSlider Set pTheSlider = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("sldWidth")

JScript

var pTheSlider; pTheSlider = Application.Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("sldWidth");

Event reference This involves referencing an Slider control in an event handling script. For example, to reference an Slider control with the name "sldWidth" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheSlider Set pTheSlider = ThisEvent.Object.Pages("pgPage1").Controls("sldWidth")

JScript

var pTheSlider; pTheSlider = ThisEvent.Object.Pages("pgPage1").Controls("sldWidth");

Using SymbologyField Controls

See Also

Use a SymbologyField control to present the list of symbols and labels as defined in the layer's symbology in a drop down list. SymbologyField controls can only be added to layer attribute forms (Edit or Identify).

SymbologyField controls are represented by Control objects in the ArcPad object model and by SYMBOLOGYFIELD elements in ArcPad XML.

Although SymbologyField controls expose properties, methods, and events to the ArcPad Object Model, it is not expected that you will customize these controls. SymbologyField controls are highly automated controls that work directly with a layer's symbology definition (in other words, the legend).

Attributes

Page 26 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 27: Formulario arcpad

SymbologyField control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the layer definition in ArcPad XML format.

name - The name of the SymbologyField control. Used to reference the SymbologyField control in scripts. width - The width of the control. height - The height of the control. x - The x coordinate of the upper left corner of the control. y - The y coordinate of the upper left corner of the control. sip - Specifies if the SIP (soft input panel) is displayed on pen devices when the control gets the focus. defaultvalue - A simple expression that specifies the default value of the control. group - Specifies whether the SymbologyField control starts a new group of controls. border - Specifies whether the control has a border. tabstop - Specifies whether the TAB key can be used to move the focus to the control. readonly - Specifies whether the control's value can be modified by the user. backgroundcolor - The background color to use for the control. If not specified, this value is inherited from the page's backgroundcolor attribute. color - The color to use for the control's text. If not specified, this value is inherited from the page's color attribute. font - The font to use for the control's text. If not specified, this value is inherited from the page's font attribute. fontsize - The font size to use for the control's text. If not specified, this value is inherited from the page's fontsize attribute. fontstyle - The font style to use for the control's text. If not specified, this value is inherited from the page's fontstyle attribute. onsetfocus - The script to run when an OnSetFocus event occurs. onkillfocus - The script to run when an OnKillFocus event occurs.

Events SymbologyField controls generate a range of events as they are operating. You can specify a script to run whenever any of these events occur in the Events page of the Control Properties dialog box. The following SymbologyField control events are available, however it is not recommended that you write event handler script code for SymbologyField controls, except in specialized cases. SymbologyField is a highly automated control that works directly with the layer's legend.

OnKillFocus - Occurs when the symbologyfield loses the focus. OnSetFocus - Occurs when the symbologyfield gets the focus.

Properties SymbologyField control properties can be read and set at run-time via scripts. The following SymbologyField control properties are available, however it is not recommended that you write script code for SymbologyField controls, except in specialized cases. SymbologyField is a highly automated control that works directly with the layer's legend.

DefaultValue - Returns or sets the default value expression for the symbology field. Enabled - Returns or sets a value that determines if the symbology field is enabled. hWnd - Returns the window handle of the symbology field. Index - Returns the index of the symbology field. ListCount - Returns the number of items in the list for the symbology field. ListIndex - Returns or sets the index of the currently selected item in the symbology field. Name - Returns the name of the symbology field. Parent - Returns a reference to the page that contains the symbology field. Properties - Returns the value of the specified property for the symbology field. Text - Returns the text of the item currently displayed in the symbology field. Type - Returns the type of the control ("SYMBOLOGYFIELD" for a symbology field). Value - Returns the value of the item currently displayed in the symbology field. Visible - Returns or sets a value that determines whether the symbology field is visible.

Methods SymbologyField control methods can be called at run-time via scripts. The following SymbologyField control methods are available, however it is not recommended that you write script code for SymbologyField controls, except in specialized cases. SymbologyField is a highly automated control that works directly with the layer's legend.

SetFocus - Sets the focus to the symbology field.

Getting a reference to a SymbologyField control You can only reference a SymbologyField control in a form that is currently displayed. Attempting to reference a SymbologyField control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a SymbologyField control:

Direct reference This involves referencing a SymbologyField control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a SymbologyField control with the name "sfPoles" on a page with the name "pgPage1" in an edit form with the name "EDITFORM" that is present in a layer with the name "Poles", you would use the code:

VBScript

Dim pTheSymbologyField Set pTheSymbologyField = Layer.Forms("EDITFORM").Pages("pgPage1").Controls("sfPoles")

JScript

var pTheSymbologyField; pTheSymbologyField = Layer.Forms("EDITFORM").Pages("pgPage1").Controls("sfPoles");

The above code assumes that it is present in the layer definition itself. If you need to reference the same SymbologyField control from a different layer definition, or other customization file, you need to explicitly reference the layer definition. For example:

VBScript

Dim pTheSymbologyField Set pTheSymbologyField = Application.Map.Layers("Poles").Forms("EDITFORM").Pages("pgPage1").Controls("sfPoles")

JScript

var pTheSymbologyField; pTheSymbologyField = Application.Map.Layers("Poles").Forms("EDITFORM").Pages("pgPage1").Controls("sfPoles");

Page 27 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 28: Formulario arcpad

Event reference This is the recommended approach. It involves referencing a SymbologyField control in an event handling script. For example, to reference a SymbologyField control in its OnSetActive event handler, you would use the code:

VBScript

Dim pTheSymbologyField Set pTheSymbologyField = ThisEvent.Object

JScript

var pTheSymbologyField; pTheSymbologyField = ThisEvent.Object;

To reference a pTheSymbologyField control with the name "sfPole" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheSymbologyField Set pTheSymbologyField = ThisEvent.Object.Pages("pgPage1").Controls("sfPole")

JScript

var pTheSymbologyField; pTheSymbologyField = ThisEvent.Object.Pages("pgPage1").Controls("sfPole");

Using UpDown Controls

See Also

Use an UpDown control to present a pair of arrow buttons that the user can click to increment or decrement a number displayed in an associated Edit control. The number stays within the scroll range of the UpDown control.

UpDown controls are represented by Control objects in the ArcPad object model and by UPDOWN elements in ArcPad XML.

Attributes UpDown control attributes are set at design-time in ArcPad Studio in the Control Properties dialog box. They cannot be changed at run-time (some attributes have corresponding properties that can be accessed and changed at run-time. See the Attributes Vs. Properties topic for details). Attributes beginning with the letters "on" are used to specify the script to run when an event occurs. These attributes are set in the Events page of the Control Properties dialog box. Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

name - The name of the UpDown control. Used to reference the UpDown control in scripts. width - The width of the control. height - The height of the control. x - The x coordinate of the upper left corner of the control. y - The y coordinate of the upper left corner of the control. alignment - The alignment of the control with respect to its buddy control. orientation - The placement of the arrow buttons on the control (horizontal or vertical). group - Specifies whether the control starts a new group of controls. border - Specifies whether the control has a border. lower - The minimum number in the scroll range of the control. upper - The maximum number in the scroll range of the control. buddy - The Edit control that is associated with the UpDown control.

Events UpDown controls do not generate any events.

Properties UpDown control properties can be read and set at run-time via scripts. The following UpDown control properties are available:

Enabled - Returns or sets a value that determines if the control is enabled. hWnd - Returns the window handle of the control. Index - Returns the index of the control. Name - Returns the name of the control. Parent - Returns a reference to the page that contains the control. Type - Returns the type of the control ("UPDOWN" for an UpDown control). Visible - Returns or sets a value that determines whether the control is visible.

Methods UpDown controls do not support any methods.

Getting a reference to a UpDown control You can only reference a UpDown control in a form that is currently displayed. Attempting to reference a UpDown control in a form that is not currently displayed will result in a run-time error. There are two approaches to referencing a UpDown control:

Direct reference This involves referencing a UpDown control via its name, its page's name, its form's name, and its form's parent object. For example, to reference a UpDown control with the name "updHeight" on a page with the name "pgPage1" in a form with the name "frmSettings" that is present in an applet with the name "Custom Settings", you would use the code:

VBScript

Dim pTheUpDown Set pTheUpDown = Applet.Forms("frmSettings").Pages("pgPage1").Controls("updHeight")

JScript

var pTheUpDown;

Page 28 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm

Page 29: Formulario arcpad

pTheUpDown = Applet.Forms("frmSettings").Pages("pgPage1").Controls("updHeight");

The above code assumes that it is present in the applet itself (that is, in the .APA file or its associated script file). If you need to reference the same UpDown control from a different applet, or other customization file, you need to explicitly reference the applet. For example:

VBScript

Dim pTheUpDown Set pTheUpDown = Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("updHeight")

JScript

var pTheUpDown; pTheUpDown = Applets("Custom Settings").Forms("frmSettings").Pages("pgPage1").Controls("updHeight");

Event reference This involves referencing an UpDown control in an event handling script. For example, to reference an UpDown control with the name "updHeight" on a page with the name "pgPage1" in the OnLoad event handler of its form, you would use the code:

VBScript

Dim pTheUpDown Set pTheUpDown = ThisEvent.Object.Pages("pgPage1").Controls("updHeight")

JScript

var pTheUpDown; pTheUpDown = ThisEvent.Object.Pages("pgPage1").Controls("updHeight");

Page 29 of 29Customizing forms: an overview

31/01/2011file://C:\Documents and Settings\Administrador\Configuración local\Temp\~hh4076.htm