Navigation: Language Reference > 13 - Built-in Functions >====== SELECT (select next control to process) ====== | ![]() ![]() ![]() |
SELECT( [control] [,position] [,endposition] )
SELECT | Sets the next control to receive input focus. |
control | A field number or field equate label of the next control to process. If omitted, the SELECT statement initiates AcceptAll mode. |
position | Specifies a position within the control to place the cursor. For an ENTRY or TEXT, SPIN, or COMBO control this is a character position, or a beginning character position for a marked block. For an OPTION structure, this is the selection number within the OPTION. For a LIST control, this is the QUEUE entry number. This parameter can also be specified using property syntax by PROP:Selected or PROP:SelStart. |
endposition | Specifies an ending character position within an ENTRY, TEXT, SPIN, or COMBO control. The character position specified by position and endposition are marked as a block, available for cut and paste operations. This parameter can also be specified using property syntax by PROP:SelEnd. |
SELECT overrides the normal TAB key sequence control selection order of an APPLICATION or WINDOW. Its action affects the next ACCEPT statement that executes. The control parameter determines which control the ACCEPT loop will process next. If control specifies a control which cannot receive focus because a DISABLE or HIDE statement has been issued, focus goes to the next control following it in the window's source code that can receive focus. If control specifies a control on a TAB which does not have focus, the TAB is brought to the front before the control receives focus.
SELECT with position and endposition parameters specifies a marked block in the control which is available for cut and paste operations. You can use the SELECT statement to force navigation to a specific tab by specifying the TAB control's position number within the sheet as the second parameter: SELECT(?Sheet,TabNumber).
SELECT with no parameters initiates AcceptAll mode (also called non-stop mode). This is a field edit mode in which each control in the window is processed in Field Equate sequence by generating EVENT:Accepted for each. This allows data entry validation code to execute for all controls, including those that the user has not touched.
AcceptAll mode terminates when any of the following conditions is met:
·A SELECT(?) statement selects the same control for the user to edit. This code usually indicates the value it contains is invalid and the user must re-enter data.
·The Window{PROP:AcceptAll} property is set to zero (0). This property contains one (1) when AcceptAll mode is active. Assigning values to this property can also be used to initiate and terminate AcceptAll mode.
·A control with the REQ attribute is blank or zero. AcceptAll mode terminates with the control highlighted for user entry, without processing any more fields in the Field Equate key sequence.
When all controls have been processed, PROP:AcceptAll is zero and EVENT:Completed is posted to the window.
Example:
Screen WINDOW,PRE(Scr)
ENTRY(@N3),USE(Ctl:Code)
ENTRY(@S30),USE(Ctl:Name)
LIST,USE(Ctl:Type),From(TypeQue),Drop(5)
BUTTON('OK'),USE(?OkButton),KEY(EnterKey)
BUTTON('Cancel'),USE(?CanxButton),KEY(EscKey)
END
CODE
OPEN(Screen)
SELECT(?Ctl:Code) !Start with Ctl:Code
ACCEPT
CASE SELECTED()
OF ?Ctl:Type
GET(TypeQue,Ctl:Type) !Find type in List
SELECT(?Ctl:Type,POINTER(TypeQue) !Select list to element
END
CASE ACCEPTED()
OF ?Ctl:Code
IF Ctl:Code > 150 !If data entered is invalid
BEEP !alert the user and
SELECT(?) !make them re-enter the data
END
OF ?Ctl:Name
SELECT(?Ctl:Name,1,5) !Mark first five characters as a block
OF ?OkButton
SELECT !Initiate AcceptAll mode
END
IF EVENT() = EVENT:Completed
BREAK !AcceptAll mode terminated
END
END
See Also: