How to Use the Spinner Control
Keywords: Spinner Initial Minimum Maximum Increment decrement
Question:
How can I specify the range of values for the spinner control in a dialog?Answer:
You would use the control’s variable attribute to set the range of values that the control will display. The variable should contain a vertical bar (|) delimited list with two or three items."{minimum}|{maximum}|{increment/decrement}"Make the first item the minimum value and the second the maximum value. Note: The minimum value can be greater than the maximum value but both values must be in the range of –32768 to 32767 and the difference between the values cannot exceed 32767.The third value indicates the amount to add or subtract from the displayed number each time the user clicks an up or down arrow. The control adds or subtracts one (1) each time, if you do not supply the third value.
The final value selected by the user is placed in the Variable when the dialog function returns.
You can indicate the initial value for your control by placing a number in the in the text attribute of the control definition. The control will default to the minimum value if you do not indicate an initial value or if your initial value does not fall within the range you have selected in the Variable attribute.
settings = "1|100|1" MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=002 MyDialogY=030 MyDialogWidth=107 MyDialogHeight=092 MyDialogNumControls=002 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialog001=`028,068,033,011,PUSHBUTTON,DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`034,033,022,015,SPINNER,settings,"1",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") Message("Spinner Value selected",settings)
Question:
I am interested in creating a dialog with a spinner control. I want the spinner control to have a initial value of 100 and for it to increment to 1000 by 50. How would I accomplish this?Answer:
initvalue = 100 min = 100 max = 1000 increment = 50 settings = StrCat(min, "|", max, "|", increment) ;"100|1000|50" MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=002 MyDialogY=030 MyDialogWidth=107 MyDialogHeight=092 MyDialogNumControls=002 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialog001=`028,068,033,011,PUSHBUTTON,DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`034,033,022,015,SPINNER,settings,%initvalue%,DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") Message("Spinner Value selected",settings)