Navigation: Language Reference > 8 - Controls > Control Declarations >====== COMBO (declare an entry/list control) ====== | |
COMBO(picture),FROM( ) ,AT( ) [,CURSOR( )] [,USE( )] [,LAYOUT( )][,DISABLE] [,KEY( )] [,MSG( )] [,HLP( )]
[,SKIP][,FONT( )][,FORMAT( )][,DROP][,COLUMN][,VCR][,FULL][,GRID( )][,SCROLL] | ||
[,ALRT( )][,HIDE][,READONLY][,REQ][,NOBAR][DROPID( )][,TIP( )] [,FLAT][,TRN][,COLOR()] |
[, | MARK() | ] | [, | HSCROLL | ] | [, | LEFT | ] | [, | INS | ] | [, | UPR | ] [,MASK] | ||
IMM | VSCROLL | RIGHT | OVR | CAP | ||||||||||||
HVSCROLL | CENTER | |||||||||||||||
DECIMAL |
COMBO | Places a data entry field with an associated list of data items on the WINDOW or TOOLBAR. |
picture | A display picture token that specifies the input format for the data entered into the control (PROP:Text). |
FROM | Specifies the origin of the data displayed in the list (PROP:FROM). |
AT | Specifies the initial size and location of the control (PROP:AT). If omitted, the runtime library chooses a value. |
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 and entry orientation (PROP:LAYOUT) |
DISABLE | Specifies the control appears dimmed when the WINDOW or APPLICATION is first opened (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). |
FORMAT | Specifies the display format of the data (PROP:FORMAT). |
DROP | Specifies a drop-down list box and the number of elements the drop-down portion contains (PROP:DROP). |
COLUMN | Specifies a field-by-field highlight bar on multi-column list boxes (PROP:COLUMN). |
VCR | Specifies a VCR-type control that appears left of any horizontal scroll bar (PROP:VCR). |
FULL | Specifies the control expands to occupy the entire size of the WINDOW for any missing AT attribute width or height parameter (PROP:FULL). |
GRID | Specifies the color of the grid lines between columns in the list (PROP:GRID). |
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). |
NOBAR | Specifies the highlight bar is displayed only when the LIST has focus (PROP:NOBAR). |
DROPID | Specifies the control may serve as a drop target for drag-and-drop actions (PROP:DROPID). |
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). This applies both the ENTRY and LIST sub-controls. |
TRN | Specifies the control transparently displays over the background (PROP:TRN). |
COLOR | Specifies background and selected colors for the control (PROP:COLOR). |
REQ | Specifies the control may not be left blank or zero (PROP:REQ). |
MARK | Specifies multiple item selection mode (PROP:MARK). |
IMM | Specifies generation of an event whenever the user presses any key (PROP:IMM). |
HSCROLL | Specifies that a horizontal scroll bar is automatically added to the list box when any portion of the data item lies horizontally outside the visible area (PROP:HSCROLL). |
VSCROLL | Specifies that a vertical scroll bar is automatically added to the list box when any data items lie vertically outside the visible area (PROP:VSCROLL). |
HVSCROLL | Specifies that both vertical and horizontal scroll bars are automatically added to the list box when any portion of the data items lies outside the visible area. |
LEFT | Specifies that the data is left justified within the control (PROP:LEFT). |
RIGHT | Specifies that the data is right justified within the control (PROP:RIGHT). |
CENTER | Specifies that the data is centered within the control (PROP:CENTER). |
DECIMAL | Specifies that the data is aligned on the decimal point within the control (PROP:DECIMAL). |
INS / OVR | Specifies Insert or Overwrite entry mode (PROP:INS and PROP:OVR). This is valid only on windows with the MASK attribute). |
UPR / CAP | Specifies all upper case or proper name capitalization (First Letter Of Each Word Capitalized) data entry (PROP:UPR and PROP:CAP). |
MASK | Specifies pattern input editing mode of the ENTRY portion of the control (PROP:MASK). |
The COMBO control places a data entry field with an associated list of data items on the WINDOW or TOOLBAR (not valid in a REPORT) at the position and size specified by its AT attribute (a combination of an ENTRY and LIST control). The user may type in data or select an item from the list. The entered data is not automatically validated against the entries in the list. The data entry portion of the COMBO acts as an “incremental locator” to the list–as the user types each character, the highlight bar is positioned to the closest matching entry.
A COMBO with the DROP attribute displays only the currently selected data item on screen until the control has focus and the user presses the down arrow key, or CLICKS ON the the icon to the right of the displayed data item. When either of these occurs, the selection list appears (“drops down”) to allow the user to select an item.
A COMBO with the IMM attribute generates an EVENT:NewSelection every time the user moves the highlight bar to another selection, or presses any key (all keys are implicitly ALRTed). This allows an opportunity for the source code to re-fill the display QUEUE, or get the currently highlighted record to display other fields from the record. A COMBO with the VCR attribute has scroll control buttons like a Video Cassette Recorder to the left of the horizontal scroll bar (if there is one). These buttons allow the user to use the mouse to scroll through the list.
Regarding the runtime alignment properties (PROP:Left, PROP:LeftOffset, PROP:Right, PROP:RightOffset, PROP:Center, PROP:CenterOffset, PROP:Decimal, PROP:DecimalOffset) applied to the drop (list) box, these properties are applied only to the ENTRY part of the COMBO control by default. To apply these properties to the LIST component, use them in conjunction with the PROP:ListFeq property:
?Drop {PROP:Left} = TRUE ! Set static part left aligned
(?Drop {PROP:ListFeq}) {PROP:Right} = TRUE ! Set lit part right aligned
Alignment properties defined for drop boxes in the WINDOW declaration are applied to both ENTRY and LIST by default.
Events Generated:
EVENT:Selected | The control has received input focus. |
EVENT:Accepted | The user has either selected an entry from the list 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 current selection in the list has changed (highlight bar has moved up or down) or the user pressed any key (only with the IMM attribute). |
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. |
EVENT:ScrollUp | The user pressed the up arrow (only with the IMM attribute). |
EVENT:ScrollDown | The user pressed the down arrow (only with the IMM attribute). |
EVENT:PageUp | The user pressed PgUp (only with the IMM attribute). |
EVENT:PageDown | The user pressed PgDn (only with the IMM attribute). |
EVENT:ScrollTop | The user pressed Ctrl-PgUp (only with the IMM attribute). |
EVENT:ScrollBottom | The user pressed Ctrl-PgDn (only with the IMM attribute). |
EVENT:PreAlertKey | The user pressed a printable character (only with the IMM attribute) or an ALRT attribute hot key. |
EVENT:AlertKey | The user pressed a printable character (only with the IMM attribute) or an ALRT attribute hot key. |
EVENT:Locate | The user pressed the locator VCR button (only with the IMM attribute). |
EVENT:ScrollDrag | The user moved the scroll bar's “thumb” and its new position is in PROP:VScrollPos (only with the IMM attribute). |
EVENT:ScrollTrack | The user is moving the scroll bar's “thumb” and its new position is in PROP:VScrollPos (only with the IMM attribute). |
EVENT:DroppingDown | The user pressed the down arrow button (only with the DROP attribute). |
EVENT:DroppedDown | The list has dropped (only with the DROP attribute). |
EVENT:ColumnResize | A column in the list has been resized. |
Example:
MDIChild WINDOW('Child One'),AT(0,0,320,200),MDI,MAX,HVSCROLL
COMBO(@S8),AT(0,0,20,20),USE(C1),FROM(Que)
COMBO(@S8),AT(20,0,20,20),USE(C2),FROM(Que),KEY(F10Key)
COMBO(@S8),AT(40,0,20,20),USE(C3),FROM(Que),MSG('Button 3')
COMBO(@S8),AT(60,0,20,20),USE(C4),FROM(Que),HLP('Check4Help')
COMBO(@S8),AT(80,0,20,20),USE(C5),FROM(Q) |
,FORMAT('5C~List~15L~Box~'),COLUMN
COMBO(@S8),AT(100,0,20,20),USE(C6),FROM(Que),FONT('Arial',12)
COMBO(@S8),AT(120,0,20,20),USE(C7),FROM(Que),DROP(8)
COMBO(@S8),AT(140,0,20,20),USE(C8),FROM(Que),HVSCROLL,VCR
COMBO(@S8),AT(160,0,20,20),USE(C9),FROM(Que),IMM
COMBO(@S8),AT(180,0,20,20),USE(C10),FROM(Que),CURSOR(CURSOR:Wait)
COMBO(@S8),AT(200,0,20,20),USE(C11),FROM(Que),ALRT(F10Key)
COMBO(@S8),AT(220,0,20,20),USE(C12),FROM(Que),LEFT
COMBO(@S8),AT(240,0,20,20),USE(C13),FROM(Que),RIGHT
COMBO(@S8),AT(260,0,20,20),USE(C14),FROM(Que),CENTER
COMBO(@N8.2),AT(280,0,20,20),USE(C15),FROM(Que),DECIMAL
COMBO(@S8),AT(300,0,20,20),USE(C16),FROM('Apples|Peaches|Pumpkin|Pie')
COMBO(@S8),AT(320,0,20,20),USE(C17),FROM('TBA')
END
CODE
OPEN(MDIChild)
?C17{PROP:From} = 'Live|Long|And|Prosper' !Runtime FROM attribute assignment
ACCEPT
CASE ACCEPTED()
OF ?C1
LOOP X# = 1 to RECORDS(Que) !Check for user's entry in Que
GET(Que,X#)
IF C1 = Que THEN BREAK. !Break loop if present
END
IF X# > RECORDS(Que) !Check for BREAK
Que = C1 !and add the entry
ADD(Que)
END
END
END
See Also: