Table Spinner

Spinner: a component that show arrows to select value in a pre-defined list.

A Spinner and a Slider, the spinner change the unit of the slider. The last one show the focus on the spinner.

See
SMDialog:addSpinner

Summary

FieldTypeSummary
IsIgnoreCtrlShiftbooleanIgnore Ctrl and Shift strokes that navigate faster?
IsSearchablebooleanDoes the spinner accept alpha-numeric strokes to search a value?
ValuestringValue of the spinner
ValueAsCaptionbooleanDisplay value (Map key, table index...) instead of label?
Return typeFunction and summary
 NextValue(Dialog dlg, Spinner spinner)
Select the next value.
 OnChange(Dialog dlg, Spinner spinner, string oldValue, string newValue)
Function fired when value is modified.
 PreviousValue(Dialog dlg, Spinner spinner)
Select the previous value.
booleanSearch(Dialog dlg, Spinner spinner, string startsWith)
Search and select next value which label starts with startsWith If the end of the list is reached, the search restarts to the top of the list.
 SetValuesList(Dialog dlg, Spinner spinner, table valuesList, string defaultValue, boolean changeFocusableState, string newValue)
Change the list of values in the Spinner.

Fields

string Spinner.Value

Value of the spinner

boolean Spinner.ValueAsCaption

Display value (Map key, table index...) instead of label?

For accessibility, label is pronounced.

boolean Spinner.IsIgnoreCtrlShift

Ignore Ctrl and Shift strokes that navigate faster?

false by default. Set it to true if you assign shortcut with Ctrl and Shift to the Spinner or its two buttons, or if it's not relevant, not enough entries.

boolean Spinner.IsSearchable

Does the spinner accept alpha-numeric strokes to search a value?

By default enabled, when Spinner is focused or under mouse pointer, keystrokes are processed to search an entry in the spinner. This is a fast way to navigate typing the first letters of an entry. Disable it to let keystroke active shortcuts in the dialog, or if search is no relevant.

Functions

Spinner.SetValuesList(Dialog dlg, Spinner spinner, table valuesList, string defaultValue, boolean changeFocusableState, string newValue)

Change the list of values in the Spinner.

After creation, you can change the list of values.

ParameterTypeDefaultDescription
dlgDialog dlg
spinnerSpinner spinner
valuesListtable 
  • table of string values t[1]="Value1"; t[2]="Value2"
  • or values to caption: t["ms"]="milliseconds"; t["s"]="seconds"; t["m"]="minutes"
  • or Collection of strings
  • or Map of string to string
defaultValuestringnilDefault value from the list. If nil first value from the list is selected.
changeFocusableStatebooleantrueSet it to false if you don't want to modify .IsFocusable value, even if the list has more than 1 item.
newValuestring newValue

Spinner.OnChange(Dialog dlg, Spinner spinner, string oldValue, string newValue)

Function fired when value is modified.

ParameterTypeDefaultDescription
dlgDialog The MyrScript Dialog object
spinnerSpinner The spinner
oldValuestring The old value of the spinner
newValuestring The new value of the spinner

Spinner.PreviousValue(Dialog dlg, Spinner spinner)

Select the previous value.

This will be really visible on next OnIdle event.

ParameterTypeDefaultDescription
dlgDialog The MyrScript Dialog object
spinnerSpinner spinner

Spinner.NextValue(Dialog dlg, Spinner spinner)

Select the next value.

This will be really visible on next OnIdle event.

ParameterTypeDefaultDescription
dlgDialog The MyrScript Dialog object
spinnerSpinner spinner

Spinner.Search(Dialog dlg, Spinner spinner, string startsWith)

Search and select next value which label starts with startsWith If the end of the list is reached, the search restarts to the top of the list.

This will be really visible on next OnIdle event.

ParameterTypeDefaultDescription
dlgDialog The MyrScript Dialog object
spinnerSpinner spinner
startsWithstring startsWith
Return
boolean: true if the search gave different result, false if the only one is already selected, that means no change.