Maptitude GISDK Help |
A spinner item allows the user to select a value from a specified list or to type another value that is not one of the given choices. Two arrow buttons are provided for the user to move through the values in the list. It is designed to be used with ordered lists of values, such as font sizes, so that pressing the up button will increase the value and vice-versa. If the user types a value that is not in the list and then presses the up button, the next item higher (or lower for the down button) will be selected.
The format of a spinner item definition is:
Spinner {"item name"} hpos, vpos {, width} {options} {do
<statements go here>
endItem}
If the do ... endItem section of the Spinner definition is included, the statements are executed whenever the user changes the selection in the spinner. If the width is not specified, the spinner is ten characters wide. The height is always one character by default.
Spinner Options |
Description |
Key: hotkey |
The key sequence the user can press to move the cursor to the spinner instead of using the mouse. The hotkey has the format alt_character, where character must be a letter or number. For example, Key: alt_A indicates that holding the Alt key and pressing A activates the item. The specified key is underlined in the item's text. A hotkey only works if the key in question is part of the item's text and is case insensitive. |
Disabled |
The spinner is initially disabled |
Hidden |
The spinner is initially hidden |
Help: help_specs |
Help information displayed in a popup window and the status bar Help strings can be string expressions. |
Prompt: expression |
The text that appears to the left of the spinner; if omitted, there is no text next to the spinner |
List: array |
An array of items displayed in the spinner; the array can contain strings, integers or real numbers |
Variable: variable |
A string containing the current value displayed in the spinner |
Here is an example:
Spinner 8, 2, 20 prompt: "Size" list: sizes variable: choice do
RunMacro("set font size")
enditem
A numeric spinner list only needs three values, at the most: the current value, the next higher value (if not at the maximum), and the next lower (if not at the maximum). The following macro will create an array for the List: option, turning integers or reals into strings to match the Variable: option:
// Create list for spinner, limited by low and high values
Macro "Build Spinner List" (val, step, low, high)
val = Max(low, Min(val, high))
spinnerlist = {r2s(val)}
if val - step ge low then spinnerlist = {r2s(val - step)} + spinnerlist
if val + step le high then spinnerlist = spinnerlist + {r2s(val + step)}
Return(spinnerlist)
endMacro
Then the spinner can be something like this, for a range of integers from 0 to 100:
Spinner 8, 20, 10 Prompt: "Percent" List: SpinnerList Variable: SpinnerText do
SpinnerVal = s2r(SpinnerText)
SpinnerList = RunMacro("Build Spinner List", SpinnerVal, 1, 0, 100)
endItem
©2025 Caliper Corporation | www.caliper.com |