Navigation: Language Reference > 8 - Controls > Control Declarations >====== SPIN (declare a spinning list control) ====== | |
SPIN(picture) ,AT( ) [,CURSOR()] [,USE()] [,LAYOUT( )] [,DISABLE] [,KEY()] [,MSG()] [,HLP()] [,SKIP] [,FONT()][,FULL]
[,SCROLL][,ALRT()][,HIDE][,READONLY][,REQ] [,IMM][,TIP()] [,FLAT][,TRN][DROPID()]
[,COLOR()][,REPEAT( )] [,DELAY( )] [,MASK]
[, | UPR | ] | [, | LEFT | ] | [, | INS | ] | , | RANGE()[,STEP] | [, | HSCROLL | ] | |
CAP | RIGHT | OVR | FROM( ) | VSCROLL | ||||||||||
CENTER | HVSCROLL | |||||||||||||
DECIMAL |
SPIN | Places a “spinning” list of data items on the WINDOW or TOOLBAR. |
picture | A display picture token that specifies the format for the data displayed in the control (PROP:Text). |
AT | Specifies the initial size and location of the control (PROP:AT). If omitted, default values are selected by the runtime library. |
CURSOR | Specifies a mouse cursor to display when the mouse is positioned over the control (PROP:CURSOR). If omitted, the WINDOW's CURSOR attribute is used, else the Windows default cursor is used. |
USE | A field equate label to reference the control in executable code or the label of the variable that receives the value selected by the user (PROP:USE). |
LAYOUT | Specifies the control's left-to-right or right-to-left display orientation (PROP:LAYOUT) |
DISABLE | Specifies the control appears dimmed when the WINDOW or APPLICATION opens (PROP:DISABLE). |
KEY | Specifies an integer constant or keycode equate that immediately gives focus to the control (PROP:KEY). |
MSG | Specifies a string constant containing the text to display in the status bar when the control has focus (PROP:MSG). |
HLP | Specifies a string constant containing the help system identifier for the control (PROP:HLP). |
SKIP | Specifies the control receives input focus to enter text only with the mouse or accelerator key and does not retain focus (PROP:SKIP). |
FONT | Specifies the display font for the control (PROP:FONT). |
FULL | Specifies the control expands to occupy the entire size of the WINDOW for any missing AT attribute width or height parameter (PROP:FULL). |
SCROLL | Specifies the control scrolls with the window (PROP:SCROLL). |
ALRT | Specifies “hot” keys active for the control (PROP:ALRT). |
HIDE | Specifies the control does not appear when the WINDOW or APPLICATION is first opened (PROP:HIDE). UNHIDE must be used to display it. |
READONLY | Specifies the control does not allow data entry (PROP:READONLY). Specifically, this only affects manual entry into the spin control. The spin buttons always allow data entry. To disable the spin buttons you need to disable the control. |
REQ | Specifies the control may not be left blank or zero (PROP:REQ). |
IMM | Specifies immediate event generation whenever the user presses any key (PROP:IMM). |
TIP | Specifies the text that displays as “balloon help” when the mouse cursor pauses over the control (PROP:ToolTip). |
FLAT | Specifies that the control does not have a 3D border drawn around it (PROP:FLAT). |
TRN | Specifies the control transparently displays over the background (PROP:TRN). |
DROPID | Specifies the control may serve as a drop target for drag-and-drop actions (PROP:DROPID). |
COLOR | Specifies background and selected colors for the control (PROP:COLOR). |
REPEAT | Specifies the rate at which EVENT:NewSelection generates when the spin buttons are held down by the user (PROP:REPEAT). |
DELAY | Specifies the delay between the first and second generation of EVENT:NewSelection when the spin buttons are held down by the user (PROP:DELAY). |
MASK | Specifies pattern input editing mode of the ENTRY portion of the control (PROP:MASK). |
UPR / CAP | Specifies all upper case or proper name capitalization (First Letter Of Each Word Capitalized) entry (PROP:UPR and PROP:CAP). |
LEFT | Specifies that the data is left justified within the area specified by the AT attribute (PROP:LEFT). |
RIGHT | Specifies that the data is right justified within the area specified by the AT attribute (PROP:RIGHT). |
CENTER | Specifies that the data is centered within the area specified by the AT attribute (PROP:CENTER). |
DECIMAL | Specifies that the data is aligned on the decimal point within the area specified by the AT attribute (PROP:DECIMAL). |
INS / OVR | Specifies Insert or Overwrite entry mode (PROP:INS and PROP:OVR). Valid only on windows with the MASK attribute. |
RANGE | Specifies the range of values the user may choose (PROP:RANGE). |
STEP | Specifies the increment/decrement amount of the choices within the specified RANGE (PROP:STEP). If omitted, the STEP is 1.0. |
FROM | Specifies the origin of the choices displayed for the user (PROP:FROM). |
HSCROLL | Specifies the spin buttons are side by side, pointing right and left (PROP:HSCROLL). |
VSCROLL | Specifies the spin buttons are one above the other, pointing right and left (PROP:VSCROLL). |
HVSCROLL | Specifies the spin buttons are side by side, pointing up and down. |
The SPIN control places a “spinning” list of data items on the WINDOW or TOOLBAR (not valid in a REPORT) at the position and size specified by its AT attribute. The “spinning” list displays only the current selection with a pair of buttons to the right to allow the user to “spin” through the available selections (similar to a slot machine wheel).
If the SPIN control offers the user regularly spaced numeric choices, the RANGE attribute specifies the valid range of values from which the user may choose. The STEP attribute then works in conjunction with RANGE to increment/decrement those values by the specified amount. If the choices are not regular, or are string values, the FROM attribute is used instead of RANGE and STEP. The FROM attribute provides the SPIN control its list of choices from a memory QUEUE or a string. Using the FROM attribute, you may provide the user any type of choices in the SPIN control. The user may select an item from the list or type in the desired value, so this control also acts as an ENTRY control.
Setting an upper/lower limit to zero in the RANGE results in an undefined behavior. At least one RANGE value other than zero is required.
Events Generated:
EVENT:Selected | The control has received input focus. |
EVENT:Accepted | The user has either selected a value or entered data directly into the control, and moved on to another control. |
EVENT:Rejected | The user has entered an invalid value for the entry picture. |
EVENT:NewSelection | The user has changed the displayed value. |
EVENT:PreAlertKey | The user pressed an ALRT attribute hot key. |
EVENT:AlertKey | The user pressed an ALRT attribute hot key. |
EVENT:Drop | A successful drag-and-drop to the control. |
Example:
MDIChild WINDOW('Child One'),AT(0,0,320,200),MDI,MAX,HVSCROLL
SPIN(@S8),AT(0,0,20,20),USE(SpinVar1),FROM(Que)
SPIN(@N3),AT(20,0,20,20),USE(SpinVar2),RANGE(1,999),KEY(F10Key)
SPIN(@N3),AT(40,0,20,20),USE(SpinVar3),RANGE(5,995),STEP(5)
SPIN(@S8),AT(60,0,20,20),USE(SpinVar4),FROM(Que),HLP('Check4Help')
SPIN(@S8),AT(80,0,20,20),USE(SpinVar5),FROM(Que),MSG('Button 3')
SPIN(@S8),AT(100,0,20,20),USE(SpinVar6),FROM(Que),FONT('Arial',12)
SPIN(@S8),AT(120,0,20,20),USE(SpinVar7),FROM(Que),DROP
SPIN(@S8),AT(160,0,20,20),USE(SpinVar8),FROM(Que),IMM
SPIN(@S8),AT(220,0,20,20),USE(SpinVar9),FROM('Mr|Mrs|Ms'),LEFT
END