After you display data, the CHOOSE statement moves a highlight bar among a series of choices and selects a choice when you press GO, RETURN, or enter a unique combination of initial characters.
CHOOSEROW field HELP char-constantFIELD field HELP char-constantAUTO-RETURN COLOR color-phraseGO-ON ( key-label ) KEYS char-variableNO-ERROR PAUSE expressionframe-phraseROW fieldTells CHOOSE to move a highlight bar among iterations of a down frame. The field is the name of the field that you want the highlight bar to begin highlighting. The ROW option is useful for browsing through a set of records, although field does not have to refer to database records.If you use the ROW option with the CHOOSE statement, use the SCROLL statement as well. See the SCROLL statement reference entry examples.FIELD fieldTells CHOOSE to move a highlight bar through a set of fields or set of array elements in a frame. The field argument is the table record or array variable with fields or elements through which you want to move the highlight bar. These fields or array elements must be defined as ABL default FILL-IN widgets (not specified with the FILL-IN NATIVE option). The FIELD option is useful for building menus. You can also supply help for field.HELP char-constantCOLOR color-phraseSpecifies a video attribute or color for the highlight bar. Following is the syntax for color-phrase:
NORMAL
INPUTMESSAGESprotermcap-attributedos-hex-attributeBLINK- BRIGHT-fgnd-color bgnd-colorBLINK- RVV- UNDERLINE- BRIGHT-fgnd-colorVALUE ( expression )
GO-ON ( key-label ) . . .Names key-labels for keys that cause CHOOSE to return control to the procedure. If you do not use the GO-ON option, CHOOSE returns control to the procedure when the user presses GO, RETURN, END-ERROR, or types a unique substring when AUTO-RETURN is in effect. If you don’t specify F1, RETURN, or F4, those keys are still GO-ON keys by default.KEYS char-variableIf you want to highlight a particular choice when entering a CHOOSE statement, or if you want to know what keys the user pressed to make a selection, use the KEYS option. When you use the KEYS option, you must give the name of a character variable, char-variable. If char-variable is initialized to one of the choices before entering the CHOOSE statement, the AVM highlights that choice. As the user presses keys to move the highlight bar, the AVM saves those keystrokes in char-variable. You can test the value of char-variable after the CHOOSE statement returns control to the procedure. There is a 40‑character limit when using the KEYS option.PAUSE expressionSpecifies the overall layout and processing properties of a frame. For more information on frame-phrase, see the Frame phrase reference entry.The GO-ON option sets the GET key to perform an action like GO. With the LASTKEY function, you could check for F5 and take another action relevant to your application.
Table 12: Invalid cursor motion2 A non‑unique string followed by an alphanumeric character that does not form a matchable string3 Other keys4
The r-chs1.p procedure below, shows what the CHOOSE statement does when the user enters a non‑unique string followed by a character that, together with the rest of the string, does not match anything.
In the context of the .NET blocking method, System.Windows.Forms.Application:Run( ), if you directly or indirectly execute the CHOOSE statement while displaying a non-modal ABL window, in certain contexts (such as within a user-defined function or non-VOID method) this statement execution raises the STOP condition. For more information on the .NET Application:Run( ), method, see the reference entry for the WAIT-FOR statement (.NET and ABL).
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |