[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+----------+###############################################################
#+-| PICK_ADD |-----------------------------------+###########################
#| +----------+ Places pick_string into pick list |###########################
#+------------------------------------------------+###########################
##############################################################################
##############################################################################
#+--| Summary |--------------+################################################
#| #INCLUDE pick.hdr |################################################
#+---------------------------+################################################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------------------------------+#######
#| PROCEDURE pick_add PROTOTYPE |#######
#| PARAMETERS VALUE LONG pick_handle, CONST CHAR pick_string |#######
#+--------------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+---| Description |----------------------------------------+#########
#########| The pick_add procedure places pick_string into pick list |#########
#########| specified by pick_handle. pick_handle is the pick list |#########
#########| handle returned by pick_init(). pick_string must be a |#########
#########| NULL terminated string without control characters. That |#########
#########| is, it may not contain tabs, line-feeds or carriage |#########
#########| returns. |#########
#########| -------------------------------------------------------- |#########
#########| The FORCE library pick list manager tallies each item |#########
#########| entered into the pick list. The first string added to |#########
#########| the pick list through pick_add is 1, the second is 2, |#########
#########| etc.. The pick_list procedure returns an integer |#########
#########| representing the Nth number selected. The pick_str() |#########
#########| function returns the character string associated with |#########
#########| the Nth string in the pick list. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Get the desired transportation type of a |#########
#########| * customer from a pick list. |#########
#########| |#########
#########| FUNCTION CHAR get_trans |#########
#########| VARDEF |#########
#########| LONG plist |#########
#########| INT pvalue && Return value from the |#########
#########| && pick list. |#########
#########| CHAR rvalue && Place to store return |#########
#########| && pick string value. |#########
#########| ENDDEF |#########
#########| |#########
#########| plist = pick_init() && Initialize the pick |#########
#########| && list. Allocates |#########
#########| && memory and returns |#########
#########| && handle to plist. |#########
#########| |#########
#########| *---- Add all the possible choices to the pick list. |#########
#########| |#########
#########| pick_add( plist, "Train" ) && value 1 |#########
#########| pick_add( plist, "Plane" ) && value 2 |#########
#########| pick_add( plist, "Automobile" ) && value 3 |#########
#########| pick_add( plist, "Horse" ) && value 4 |#########
#########| |#########
#########| pick_list( plist, 11, 11, 16, 22, pvalue, .F., .F. ) |#########
#########| |#########
#########| *--- pvalue is user choice. If pvalue = 2, then |#########
#########| *--- user selected "Plane". If pvalue = 0, then |#########
#########| *--- user pressed escape. |#########
#########| |#########
#########| rvalue = "" |#########
#########| IF pvalue <> 0 |#########
#########| rvalue = pick_str( plist, pvalue ) |#########
#########| ENDIF |#########
#########| |#########
#########| pick_clear( plist ) && clear memory |#########
#########| RETURN rvalue |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Add states considered to be "Western" to |#########
#########| * pick list from a database. |#########
#########| |#########
#########| SET FILTER TO t->statetype = "west" |#########
#########| DO WHILE .NOT. eof() |#########
#########| pick_add( pick_state, t->state ) |#########
#########| SKIP |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Allow user to "insert" items into a pick list. |#########
#########| |#########
#########| ACCEPT "Insert item: " TO item |#########
#########| pick_add( p, item ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 4 |-------------------------------------------+#########
#########| * Insert two arrays into a pick list. |#########
#########| |#########
#########| FOR r = 0 TO end_count |#########
#########| pick_add( a_pick_list, names[r] ) |#########
#########| pick_add( a_pick_list, qnames[r] ) |#########
#########| NEXT |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 5 |-------------------------------------------+#########
#########| * Insert into two different pick lists at one time. |#########
#########| |#########
#########| p1 = pick_init() |#########
#########| p2 = pick_init() |#########
#########| SET FILTER TO law->citycnty |#########
#########| DO WHILE .NOT. a_eof( law ) |#########
#########| pick_add( p1, "City: "+law->ordinance ) |#########
#########| pick_add( p2, "County: "+law->ordinance ) |#########
#########| !law SKIP |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
pick_clear
pick_init()
pick_list
pick_str()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson