| Directives |
|
| Formats | 1.Define/Create: DROP_BOX
ctl_id,@(col,ln,wth,ht)[,ctrlopt] 2.Delete: DROP_BOX REMOVE ctl_id[,ERR=stmtref] 3.Disable/Enable: DROP_BOX {DISABLE | ENABLE}ctl_id[,ERR=stmtref] 4.Set Focus: DROP_BOX GOTO ctl_id[,ERR=stmtref] 5.Load via Delimited String: DROP_BOX LOAD ctl_id,dlm_list$[,ERR=stmtref] 6.Load via Array: DROP_BOX LOAD ctl_id,array_name${ALL}[,ERR=stmtref] 7.Load/Delete Index Element: DROP_BOX LOAD ctl_id,index,{element$|*}[,ERR=stmtref] 8.Retrieve Element: DROP_BOX FIND ctl_id,index,var$[,ERR=stmtref] 9.Read Current String: DROP_BOX READ ctl_id,var$[,mode$][,ERR=stmtref] 10.Read Current Index: DROP_BOX READ ctl_id,var[,mode$][,ERR=stmtref] 11.Update Selection: DROP_BOX WRITE ctl_id,element$[,ERR=stmtref] 12.Update Using Index: DROP_BOX WRITE ctl_id,index[,ERR=stmtref] 13.Clear Current Selection: DROP_BOX WRITE ctl_id, ""[,ERR=stmtref] 14.Set Focus Notification: DROP_BOX SET_FOCUS ctl_id,alt_ctl[,ERR=stmtref] 15.Report All Changes: DROP_BOX AUTO ctl_id[,ERR=stmtref] 16.Hide/Show: DROP_BOX {HIDE | SHOW} ctl_id[,ERR=stmtref]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description | Use the DROP_BOX
directive to create and manipulate drop box
control objects on the screen. A drop box normally
displays a single line on the screen with a DOWN-ARROW on the
right side. The user can select any element from a list
of items you assign to the drop box, but variable input
is not allowed. That is, the user can only
select, not enter, values. To view the list, the
user clicks on the DOWN-ARROW. When the
user selects a drop box item, the associated ctl_id is
used to generate a CTL value. Refer to VARDROP_BOX Control Variable Drop
Box, if
you need a drop box that allows both variable input and
selection from a list. Because a drop box list is in drop down form, a drop box takes a smaller amount of space on the screen than a comparable list box. In addition, ProvideX automatically supplies vertical scrollbars if the number of elements overflows the dropdown box size. Combine these features to optimize the screen design when display space is at a premium. The Apostrophe Operator can be used with the unique logical identifier (ctl_id) to dynamically read and alter a wide variety of control attributes (properties) directly from the programming language. The list of properties available for manipulating a drop boxes are described in Control Object Properties, . |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 1 | Create
Use this format to define or create a drop box and give it a unique identifier in ctl_id. You can use the FNT= option to establish the font for it. If you omit the font option, ProvideX uses the system default font. Use FNT="*" (asterisk) to set the font as standard text mode fixed font. The following example creates a drop box that generates a CTL=100 when any item is selected from it. It is loaded with the items Cat, Dog, and Pig.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 2 | Delete
Use the DROP_BOX REMOVE format to delete a drop box. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 3 | Disable/Enable
Use DROP_BOX DISABLE to gray out a drop box so that it will be visible but inaccessible, to users. To reactivate it, use DROP_BOX ENABLE. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 4 | Set Focus
Use the DROP_BOX GOTO format to set the focus on a drop box, ready for the user's next input. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Formats 5, 6 and 7 | Load a Drop Box Use DROP_BOX LOAD to add or delete the elements listed in a drop box. To add elements, you can load them from a delimited string, as an array of string elements, or individually. If you load more items into the list than the drop down box can display at one time (because of its physical size), ProvideX automatically supplies scrollbars.
Load List. When you load a drop box from a delimited string, the last character in the string must be the delimiter. That delimiter must be identical to the separator between the elements in the string. For example, in the delimited string below, the delimiter is the slash "/". It ends the string and separates the elements; e.g., DROP_BOX LOAD 12000,"Fox/Cat/Dog/Cow/Sheep/Horse/Pig/Elephant/Ant/" To clear all elements from a drop box, use a null string; e.g.,
DROP_BOX LOAD ctl_id,array_name${ALL}[,ERR=stmtref] Load Array. Use this format to load a complete array into the drop box. Note that the curly braces enclosing {ALL} are part of the syntax; e.g.,
DROP_BOX LOAD ctl_id,index,{lement$ | *}[,ERR=stmtref] Load Element. When you load individual drop box elements, use an integer value to state the index of the element before which to insert the element being loaded. For instance, if index is 1, the new element will be inserted before 1, at the start of the list. If index is 0 (zero), the new element will be appended to the end of the list. To delete or remove a specified element from a drop box, use an asterisk in place of the element string; e.g.,
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *Note* | When a
DROP_BOX LOAD is issued with no index, the
current contents of the drop box will first be cleared
and the new data will replace it. Using PxPlus, you may
alter this behaviour by setting the 'LoadPoint property
to a non-zero value. If 'Loadpoint is set to -1, the data
included with the DROP_BOX LOAD will be appended to the
list. If 'LoadPoint is set to a value > 0, the data
will be inserted into the list box at the point specified
and the value in 'LoadPoint will be reset. This functionality allows drop boxes to load a block of records at a time. The 'LoadPoint property is a +PxPlus Exclusive (build 9182) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 8 | Retrieve Element
Use the string variable in DROP_BOX FIND to retrieve a specific element from a drop box.
If the index value of zero (0) is used PxPlus will return the complete contents of the drop box.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Formats 9 and 10 | Read Current Selection Use the DROP_BOX READ formats to read which element the user has selected from the drop box. You must read the user's selection before your application can use it. Use the (optional) mode$ variable to have ProvideX return the user's method of selecting an item from the drop box. Some possible return values are:
After this value is read, the value in mode$ is reset to $00$ (null).
Read Current Element. With this format, ProvideX returns the string contents of the user's currently selected element in var$ and, optionally, the user's method of selection in mode$.
Read Current Index. Use DROP_BOX READ to read the index of the user's current selection and (optionally) the mode$ of selection. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Formats 11 and 12 | Write Current Selection Use the DROP_BOX WRITE formats described below to update a DROP_BOX to show the current selection.
Update Current Setting. If you use this format to write an element to a drop box as the current selection, the contents of the string must exactly match the value of one of the elements in the drop box. Otherwise ProvideX returns an Error #11: Record not found or Duplicate key on write.
Update Current Index. You can use the element's index number to write it to the drop box as the current selection. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 13 | Clear Current Selection
Use this format to clear the currently selected entry in drop boxes. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *Note* | This behavior can be altered by use of the '+N' & '-N' Mnemonics. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 14 | Set Focus Notification
Use the DROP_BOX SET_FOCUS format to define an alternate CTL value to generate whenever focus shifts to a drop box. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 15 | Report All Changes
Use the DROP_BOX AUTO format to have ProvideX generate a CTL value to report all changes whenever the user highlights an element from a drop box list. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Format 16 | Hide/Show
With the DROP_BOX HIDE format, the drop box remains active, but is not displayed. It is still accessible programmatically. Use the DROP_BOX SHOW format to restore the display and user access. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Example | 0010 !
DROP_BOX Creation and Use 0020 PRINT 'CS'; LIST 0030 DROP_BOX 88,@(30,18,15,10) 0040 DROP_BOX LOAD 88,"CAT,DOG,PIG,FOX," 0050 DROP_BOX WRITE 88,"CAT" 0060 LET D_BX=88 0070 SETCTL D_BX:READ_BOX 0080 DROP_BOX GOTO D_BX 0090 PRINT @(30,24),"Try Mouse and/or keyboard to select. END=<F4>" 0100 OBTAIN (0,SIZ=1,ERR=0100)@(0,0),'CURSOR'("off"),'ME',IN_VAR$,'MN' 0110 LET CT=CTL; IF CT=4 THEN GOTO END 0120 READ_BOX: 0130 DROP_BOX READ D_BX,ANIMAL$,STROKE$,ERR=0001 0140 DROP_BOX READ D_BX,IND_NUM 0150 PRINT @(30,20),"HTA(SELECTION) : ",HTA(STROKE$)," AND CTL=",CTL:"#####" 0160 PRINT @(30,21),"Index for ",ANIMAL$,@(44,21)," : ",IND_NUM,"" 0170 GOTO 0100 0180 END: 0190 DROP_BOX REMOVE D_BX 0200 PRINT 'CS' |
||||||||||||||||||||||||||||||||||||||||||||||||||||||