Slider controls

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 control and its buddy Edit control to a form, make sure the controls are positioned so 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 automatically repositions and can truncate off the form.

Slider controls are represented by Control objects in the ArcPad object model and by SLIDER elements in ArcPad Extensible Markup Language (XML).

Attributes

Slider control attributes are set at design time in ArcPad Studio on 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). For more information, see Attributes vs. properties.

Attributes are written to the customization file (layer definition, applet, default configuration) in ArcPad XML format.

The following table shows the available Slider control attributes and descriptions:

Attributes

Descriptions

name

The name of the Slider control. Used to reference the Slider control in scripts.

width

The slider's width.

height

The slider's height.

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 if the TAB key can be used to move the focus to the slider.

group

Specifies if the slider starts a new group of controls.

border

Specifies if the slider has a border.

readonly

Specifies if 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 slider's range.

upper

The maximum number in the slider's range.

buddy

The Edit control associated with the Slider control.

field

The field of the shapefile's database file (DBF) table that is linked to the slider.

Events

Slider controls do not generate events.

Properties

Slider control properties can be read and set at run time via scripts.

The following table shows the available Slider control properties and descriptions:

Properties

Descriptions

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 control's window handle.

Index

Returns the control's index.

Name

Returns the control's name.

Parent

Returns a reference to the page that contains the control.

Type

Returns the control type (for example, SLIDER for a slider).

Value

Returns or sets the slider's value.

Visible

Returns or sets a value that determines if the control is visible.

Methods

Slider controls do not support methods.

Referencing 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 results in a runtime error. The following discusses the approaches (Direct and Event) to referencing a Slider control:

Direct reference

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

VBScript

Dim objForm 
Set objForm = Applet.Forms("frmSettings")
Dim objPage
Set objPage = objForm.Pages("pgPage3")
Dim objSlider
Set objSlider = objPage.Controls("sldWidth")

JScript

var objForm = Applet.Forms("frmSettings");
var objPage = objForm.Pages("pgPage3");
var objSlider = objPage.Controls("sldWidth");

Python

objForm = Applet.Forms("frmSettings")
objPage = objForm.Pages("pgPage3")
objSlider = objPage.Controls("sldWidth")

The previous code assumes that it is present in the applet (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, explicitly reference the applet. See the following code:

VBScript

Dim objApplet
Set objApplet = Application.Applets("Custom Settings")
Dim objForm 
Set objForm = objApplet.Forms("frmSettings")
Dim objPage
Set objPage = objForm.Pages("pgPage3")
Dim objSlider
Set objSlider = objPage.Controls("sldWidth")

JScript

var objApplet = Application.Applets("Custom Settings");
var objForm = Applet.Forms("frmSettings");
var objPage = objForm.Pages("pgPage3");
var objSlider = objPage.Controls("sldWidth");

Python

objApplet = Application.Applets("Custom Settings")
objForm = Applet.Forms("frmSettings")
objPage = objApplet.Pages("pgPage3")

Event reference

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

VBScript

Dim objPage
Set objPage = ThisEvent.Object.Pages("pgPage3")
Dim objSlider
Set objSlider = objPage.Controls("sldWidth")

JScript

var objPage = ThisEvent.Object.Pages("pgPage3");
var objSlider = objPage.Controls("sldWidth");

Python

objPage = ThisEvent.Object.Pages("pgPage3")
objSlider = objPage.Controls("sldWidth")

2/7/2013