home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
FOXPRO
/
VLIST110
/
VLIST3.DOC
< prev
next >
Wrap
Text File
|
1992-09-25
|
37KB
|
1,258 lines
VList Library V1.1 -- (c) 1992, Jayson R. Minard
P.O. Box 1306
Westminster, CO 80030-1306 (USA)
===============================================================================
LIBRARY REFERENCE
===============================================================================
GLOBAL VARIABLES and MISC #DEFINEs
-------------------------------------------------------------------------------
These variables should be declared as external. The VLIST.HDR file contains
the correct definition. They are listed here with their TYPE and definition.
The variables __color_std and __color_enhcd are in the FORCE library and
are not declared in VLIST.HDR but are used in some META-Functions. Therefore
they are described here.
BYTE __color_std
This is used as the color for all normal elements in a list when the
highlight bar is NOT on the element.
BYTE __color_enhcd
This is used as the color for ALL elements in a list when the highlight
bar is ON the element.
BYTE __color_skip
The color for non-highlighted SKIPped elements. These can never
be highlighted so this will be the only color they are displayed in.
BYTE __color_hit
The color for non-highlighted HIT elements.
BYTE __color_bar
The color for the scroll-bar shaded area.
BYTE __color_tab
The color for the scroll-bar tabs.
BYTE __color_hi_std
This is the color used for any character following the __EMBED_CHAR
when displayed using VLIST_SAY(). This is when the item is NOT
highlighted.
BYTE __color_hi_enhcd
Same as __color_hi_std except when the item IS highlighted.
INT __scroll_offset
From the right border of a pick area, or of a menu, this is the
offset to display the scroll-bar. Default is 1.
CHAR( 1 ) __embed_char
The character to signify an imbedded color change. Any character
following this, when using VLIST_SAY(), will be displayed in the
__color_hi_std or __color_hi_enhcd colors.
#DEFINES:
&JL_NORMAL - a normal element status
&JL_SKIP - a skipped element status
&JL_HIT - a hit element status
&JL_HIDDEN - a hidden element status
&JL_DEFAULT - use the default color for an element
&JL_FORWARD - use with VLIST_SKIP() to determine forward direction
&JL_BACKWARD - use with VLIST_SKIP() to determine backward direction
===============================================================================
PROCEDURE/FUNCTION Reference
-------------------------------------------------------------------------------
VList_Add()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Add PROTOTYPE
PARAMETERS VALUE LONG handle,;
CONST CHAR item_string_contents
RETURN VALUE:
LOGICAL <success>
<success> value of .T. indicates that there was enough memory to create
this list element, a .F. indicates failure.
DESCRIPTION:
Adds an item to an existing list. If the list is not initialized then
a run-time error will occur. This is identical to VLIST_APPEND() except
that the status and color parameters are assumed to be &JL_NORMAL and
&JL_DEFAULT.
EXAMPLE:
handle = VList_Init( 40 )
VList_Add( handle, "Jayson was HERE!" )
-------------------------------------------------------------------------------
VList_Append()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Append PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT item_status,;
VALUE INT item_color,;
CONST CHAR item_string_contents
RETURN VALUE:
LOGICAL <success>
<success> value of .T. indicates that there was enough memory to create
this list element, a .F. indicates failure.
DESCRIPTION:
This adds an element to an EXISTING list. If the list does not exist,
a run-time error will result. The element consists of:
item_status - Either &JL_NORMAL, &JL_SKIP, &JL_HIT, or &JL_HIDDEN
item_color - Either &JL_DEFAULT, or a valid FORCE color
item_string - The CHAR contents of the string. If this is greater
than the max width of the list, then the string is
truncated.
EXAMPLE:
handle = VList_Init( 40 )
VList_Append( handle, &JL_NORMAL, &JL_DEFAULT, "Jayson was HERE!" )
VList_Append( handle, &JL_NORMAL, &BLACK_YELLOW, "this is yellow" )
-------------------------------------------------------------------------------
VList_BOL()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_BOL PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
LOGICAL <at_bottom>
<at_bottom> is .T. if the internal list pointer is past the last element
in the list, else it is .F.
DESCRIPTION:
Is similar to the database related A_EOF() and returns a logical .T.
if the list's internal pointer is PAST the end (Bottom) of the list.
EXAMPLE:
? "The list in normal order is:"
?
VList_Top( handle )
DO WHILE .NOT. VList_BOL( handle )
? VList_CStr( handle )
VList_Skip( handle, &JL_FORWARD )
ENDDO
-------------------------------------------------------------------------------
VList_Bottom()
-------------------------------------------------------------------------------
PROTOTYPE:
PROCEDURE Vlist_Bottom PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
- none -
DESCRIPTION:
Moves the internal list pointer to the last element in the list. The list
number is now equal to VLIST_MAX().
EXAMPLE:
VList_Bottom( handle )
? "The last element is: " + VList_CStr( handle )
-------------------------------------------------------------------------------
VList_CEdit()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_CEdit PROTOTYPE
PARAMETERS VALUE LONG handle,;
CONST CHAR edit_str
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the edit worked or not.
DESCRIPTION:
This allows you to change the string contents of the CURRENT element.
EXAMPLE:
temp_str = VList_CStr( handle )
temp_str = temp_str + " - Fish"
VList_CEdit( handle, temp_str )
-------------------------------------------------------------------------------
VList_CGet_Color()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION INT Vlist_CGet_Color PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
INT <current_color>
<current_color> is the current color contents of the element.
DESCRIPTION:
Returns the color of the CURRENT element. This can either
be &JL_DEFAULT or a valid FORCE color.
EXAMPLE:
old_color = VList_CGet_Color( handle )
new_color = old_color + 128 && make the sucker blink
VList_CSet_Color( handle, new_color )
-------------------------------------------------------------------------------
VList_CGet_Status()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_Cget_Status PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
UINT <current_status>
<current_status> is the current status contents of the element.
DESCRIPTION:
Returns the status contents of the CURRENT element that the internal
list pointer is pointing to. This can be one of the following macros:
&JL_NORMAL
&JL_SKIP
&JL_HIT
&JL_HIDDEN
EXAMPLE:
IF VList_CGet_Status( handle ) <> &JL_NORMAL
VList_CDelete( handle )
ENDIF
-------------------------------------------------------------------------------
VList_CReplace()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_CReplace PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT item_status,;
VALUE INT item_color,;
CONST CHAR new_str
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the replacement worked (.T.) or failed (.F.)
DESCRIPTION:
This is similar to VLIST_CEDIT() except that it changes ALL of the element's
contents including the status, color, and string contents. This works
for the CURRENT element.
EXAMPLE:
*- replace the current element with a new dude.
VList_CReplace( handle, &JL_NORMAL, &JL_DEFAULT, "New Guy!!!" )
-------------------------------------------------------------------------------
VList_CSet_Color()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Cset_Color PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE INT new_color
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the SET was successful.
DESCRIPTION:
Sets the color contents for the CURRENT element. This can either
be &JL_DEFAULT or any valid FORCE color, such as those in COLORS.HDR.
EXAMPLE:
IF LEFT( VList_CStr( handle ), 5 ) = "<DIR>"
VList_CSet_Color( handle, &BLACK_LIGHT_CYAN )
ELSE
VList_CSet_Color( handle, &JL_DEFAULT )
ENDIF
-------------------------------------------------------------------------------
VList_CSet_Status()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Cset_Status PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT new_status
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether or not the SET occured without error. An
error usually indicates that the element doesn't exist.
DESCRIPTION:
Sets the CURRENT element's status contents which can be one of the
following macros:
&JL_NORMAL
&JL_SKIP
&JL_HIT
&JL_HIDDEN
EXAMPLE:
IF LEFT( VList_CStr( handle ), 1 ) = "$"
VList_CSet_Status( handle, &JL_SKIP )
ELSE
VList_CSet_Status( handle, &JL_NORMAL )
ENDIF
-------------------------------------------------------------------------------
VList_CStr()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION CHAR Vlist_CStr PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
CHAR <contents>
<contents> is the string contents of the element.
DESCRIPTION:
Returns the string contents of the current element pointed to by the
internal list pointer.
EXAMPLE:
? "Current Element:"
? " " + VList_CStr( handle )
-------------------------------------------------------------------------------
VList_Default_Key_Handler()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION INT VLIST_Default_Key_Handler PROTOTYPE
PARAMETERS VALUE LONG list_handle,;
VALUE UINT current_element,;
UINT mouse_status,;
VALUE UINT mouse_row,;
VALUE UINT mouse_col,;
INT pick_key,;
VALUE UINT top_element_displayed,;
VALUE UINT last_element_displayed,;
VALUE UINT upper_row_of_pick_area,;
VALUE UINT upper_col,;
VALUE UINT lower_row,;
VALUE UINT lower_col
RETURN VALUE:
INT <action>
<action> is a return that informs the pick routine how to act. These
values are descibed in VLIST2.DOC under the keyboard handler section.
DESCRIPTION:
The keyboard handler interprets all mouse and keyboard activity and
responds to the call function with codes that correspond to cursor
movement, element selection, mouse movement, and the flow of the
pick. The VLIST_DEFAULT_KEY_HANDLER() is the default that can
be used with VLIST_PICK(). The name of the function is passed to
these functions without the parentheses.
EXAMPLE:
VList_SomeFunction( handle, 1, 1, 22, 50, VList_Default_Key_Handler, .T. )
-------------------------------------------------------------------------------
VList_Default_Menu_Handler()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION INT VList_Default_Menu_Handler PROTOTYPE
PARAMETERS VALUE LONG list_handle,;
VALUE UINT current_element,;
UINT mouse_status,;
VALUE UINT mouse_row,;
VALUE UINT mouse_col,;
INT pick_key,;
VALUE UINT top_element_displayed,;
VALUE UINT last_element_displayed,;
VALUE UINT upper_row_of_pick_area,;
VALUE UINT upper_col,;
VALUE UINT lower_row,;
VALUE UINT lower_col
RETURN VALUE:
INT <action>
<action> is a return that informs the pick routine how to act. These
values are descibed in VLIST2.DOC under the keyboard handler section.
DESCRIPTION:
The keyboard handler interprets all mouse and keyboard activity and
responds to the call function with codes that correspond to cursor
movement, element selection, mouse movement, and the flow of the
pick. The VLIST_DEFAULT_MENU_HANDLER() is the default that can
be used with VLIST_POPUP() and VLIST_PULLDOWN(). The name of
the function is passed to these functions without the parentheses.
EXAMPLE:
VList_SomeFunction( handle, 1, 1, 22, 50, VList_Default_Menu_Handler, .T. )
-------------------------------------------------------------------------------
VList_Default_Prompt_Handler()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION INT VLIST_Default_Prompt_Handler PROTOTYPE
PARAMETERS VALUE LONG list_handle,;
VALUE UINT current_element,;
UINT mouse_status,;
VALUE UINT mouse_row,;
VALUE UINT mouse_col,;
INT pick_key,;
VALUE UINT top_element_in_list_for_this_system,;
VALUE UINT last_element_in_list_for_this_system
RETURN VALUE:
INT <action>
<action> is a return that informs the pick routine how to act. These
values are descibed in VLIST2.DOC under the keyboard handler section.
DESCRIPTION:
The keyboard handler interprets all mouse and keyboard activity and
responds to the call function with codes that correspond to cursor
movement, element selection, mouse movement, and the flow of the
pick. The VLIST_DEFAULT_PROMPT_HANDLER() is the default that can
be used with VLIST_PROMPT(). The name of the function is passed to
these functions without the parentheses.
EXAMPLE:
VList_SomeFunction( handle, 1, 1, 22, 50, VList_Default_Key_Handler, .T. )
-------------------------------------------------------------------------------
VList_Edit()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Edit PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element,;
CONST CHAR edit_str
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the edit worked or not.
DESCRIPTION:
This allows you to change the string contents of an already existing
element 'which_element'. The list pointer is NOT moved to this
element from the current element.
EXAMPLE:
temp_str = VList_Str( handle, some_element_number )
temp_str = temp_str + " - Fish"
VList_Edit( handle, some_element_number, temp_str )
-------------------------------------------------------------------------------
VList_Get_Color()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION INT Vlist_Get_Color PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element
RETURN VALUE:
INT <current_color>
<current_color> is the current color contents of the element.
DESCRIPTION:
Returns the color of the element 'which_element'. This can either
be &JL_DEFAULT or a valid FORCE color. The current element pointer
is NOT moved to this element.
EXAMPLE:
old_color = VList_Get_Color( handle, some_poor_element )
new_color = old_color + 128 && make the sucker blink
VList_Set_Color( handle, some_poor_element, new_color )
-------------------------------------------------------------------------------
VList_Get_Status()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_Get_Status PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element
RETURN VALUE:
UINT <current_status>
<current_status> is the current status contents of the element.
DESCRIPTION:
Returns the status contents of the element 'which_element'. This
can be one of the following macros:
&JL_NORMAL
&JL_SKIP
&JL_HIT
&JL_HIDDEN
The current list pointer is not moved to this element, it will be
the 'same as it ever was' (sounds like a Talking Heads song?).
EXAMPLE:
IF VList_Get_Status( handle, some_element ) <> &JL_NORMAL
VList_Delete( handle, some_element )
ENDIF
-------------------------------------------------------------------------------
VList_Get_StrLen()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_Get_StrLen PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
UINT <max_length>
<max_length> is the maximum length an element can be in this list.
DESCRIPTION:
Returns the max element length from a specific list. This is the same
value used when initializing the list.
EXAMPLE:
handle = VList_Init( 33 )
IF VList_Get_StrLen( handle ) <> 33
? "something is wrong!"
ENDIF
-------------------------------------------------------------------------------
VList_Goto()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Goto PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> is .F. if the element number does not exist, else a .T. is
returned if the goto was successful.
DESCRIPTION:
This moves the internal list pointer to the element defined by
'which_element'.
EXAMPLE:
VList_Goto( handle, VList_Max( handle ) - 5 )
? "The 5th to last element is: " + Vlist_CStr( handle )
-------------------------------------------------------------------------------
VList_Init()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LONG Vlist_Init PROTOTYPE
PARAMETERS VALUE UINT max_string_length
RETURN VALUE:
LONG <handle>
<handle> is a pointer to the VLIST internal memory structure for a list.
This structure has information that can be checked to ensure that the list
is intact.
A return value of 0 signifies that the memory could not be allocated.
DESCRIPTION:
Initializes a VLIST with elements that will have a set length of
'max_string_length'. This list will then be active until either
a QUIT, program exit, or VLIST_CLEAR() is called.
The minimum 'max_string_length' should be 1, while the max is 254.
EXAMPLE:
handle = VList_Init( 40 )
IF handle = 0
? "error"
QUIT
ENDIF
-------------------------------------------------------------------------------
VList_Is_Init()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Is_Init PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
LOGICAL <is_init>
<is_init> is .T. if the list has been initialized using VLIST_INIT() and
has not been cleared, else it is .F.
DESCRIPTION:
This can be used to determine if a list is still or has ever been
initialized.
EXAMPLE:
some_list = VList_Init( 50 )
IF VList_Is_Init( some_list )
? "this guy should be initialized now"
ELSE
? "error, the list didn't init!"
ENDIF
VList_Clear( some_list )
? "The following should be .F."
? VList_Is_Init( some_list )
-------------------------------------------------------------------------------
VList_Max()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_Max PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
UINT <elements>
<elements> is the number of elements in the list pointed to by 'handle'.
DESCRIPTION:
Returns the number of elements in a list. This can return 0 for an
empty list. If the list is not initialized, it will cause a run-time
error.
EXAMPLE:
how_many = VList_Max( handle )
VList_Goto( handle, how_many )
? "The last element is: " + VList_CStr( handle )
-------------------------------------------------------------------------------
VList_Number()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_Number PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
UINT <current_item>
<current_item> is the current item number in the list.
DESCRIPTION:
This returns the current item number that the internal list pointer is
pointing to. If it is 0, then we are at VLIST_TOL(), if it is past
VLIST_MAX() then we are at VLIST_BOL().
EXAMPLE:
old_element = VList_Number( handle )
VList_Goto( handle, new_element )
? VList_CStr( handle )
VList_Goto( handle, old_element )
-------------------------------------------------------------------------------
VList_Pick()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_PICK PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE INT upper_row,;
VALUE INT upper_col,;
VALUE INT lower_row,;
VALUE INT lower_col,;
UINT top_element_displayed,;
VALUE UINT initial_element_selected,;
VALUE UINT first_element_allowed,;
VALUE UINT last_element_allowed,;
VALUE UINT left_string_marker_for_partial_string,;
VALUE UINT right_string_marker_for_partial_string,;
VALUE UINT number_of_columns,;
VALUE UINT spaces_between_columns,;
UNTYPED keyboard_handler_proc,;
VALUE LOGICAL display_only,;
VALUE LOGICAL scroll_bar,;
VALUE LOGICAL return_on_left_right_keystroke,;
VALUE LOGICAL is_mouse_present,;
VALUE LOGICAL allow_embedded
RETURN VALUE:
UINT <element>
<element> is the element that the cursor was on when the list was exitted.
Check LASTKEY() to determine if it was a selection (&K_ENTER was LASTKEY)
or abort (&K_ESC was LASTKEY).
A return value of 0 indicates an error with the list.
DESCRIPTION:
Displays a list range in multiple columns (Max 10). You can also set
the 'left_string_marker...' and 'right_string_marker...' parameters to
a start character and end character within the string that will be
displayed. Therefore a partial string will be displayed from each
element. This can also be used to make the window look to scroll left
and right when the elements are longer than the window is wide. To do
this, set 'return_on_left_right...' to .T., then when the list is
exitted and the LASTKEY() value was either left or right, increment
or decrement these markers and then call VLIST_PICK() again. If these
markers are set at 0, then the pick-list will execute quicker since
no sub-string is selected.
You can limit the list elements displayed by using the
'first_element_allowed' and 'last_element_allowed' to specify a range
of elements that can be selected. If these are set to 0, then they
will default to 1 and VLIST_MAX() respectively.
The default keyboard handler that can be used is VLIST_DEFAULT_KEY_HANDLER().
If 'display_only' is .T., then the intial view of the list will be displayed
and then immediately exitted. If 'scroll_bar' is .T., a scroll bar will
appear at 'lower_right' + __scroll_offset. 'allow_embedded' decides whether
VLIST_SAY() is used instead of @SAY for displaying elements.
EXAMPLE: - shows left/right scrolling imitation!
* List <handle> is init to 132 earlier and filled
* If mouse is present, 'is_mouse' is .T. from earlier code
top_element = 1
selection = 1
left_mark = 1
right_mark = 40
keep_going = .T.
aborted = .F.
DO WHILE keep_going
selection = VList_Pick( handle, 5, 5, 23, 44, top_element, selection,;
0, 0, left_mark, right_mark, 1, 0,;
VList_Default_Key_Handler,;
.F., .T., .T., is_mouse, .F. )
IF selection = 0
keep_going = .F.
LOOP
ENDIF
temp = LASTKEY()
DO CASE
CASE temp = &K_LEFT
IF left_mark > 1
left_mark = left_mark + 1
right_mark = right_mark + 1
ENDIF
CASE temp = &K_RIGHT
IF right_mark < VList_Str_Len( handle )
left_mark = left_mark + 1
right_mark = right_mark + 1
ENDIF
CASE temp = &K_ENTER
keep_going = .F.
CASE temp = &K_ESC
selection = 0
aborted = .T.
keep_going = .F.
ENDCASE
ENDDO
IF selection = 0
IF aborted
? "No element selected"
ELSE
? "ERROR!"
ENDIF
ELSE
? "Element selected: ", selection
ENDIF
-------------------------------------------------------------------------------
VList_Replace()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Replace PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element,;
VALUE UINT item_status,;
VALUE INT item_color,;
CONST CHAR new_str
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the replacement worked (.T.) or failed (.F.)
DESCRIPTION:
This is similar to VLIST_EDIT() except that it changes ALL of the element's
contents including the status, color, and string contents. This will work
for the element specified in 'which_element'. The internal element pointer
is not moved to this element, it stays where it was.
EXAMPLE:
*- replace element 15 with a new dude.
VList_Replace( handle, 15, &JL_NORMAL, &JL_DEFAULT, "New Guy!!!" )
-------------------------------------------------------------------------------
VList_Set_Color()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Set_Color PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element,;
VALUE INT new_color
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether the SET was successful.
DESCRIPTION:
Sets the color contents for the element 'which_element'. This can either
be &JL_DEFAULT or any valid FORCE color, such as those in COLORS.HDR.
The current element pointer is not moved to this element.
EXAMPLE:
IF LEFT( VList_Str( handle, some_dude ), 5 ) = "<DIR>"
VList_Set_Color( handle, some_dude, &BLACK_LIGHT_CYAN )
ELSE
VList_Set_Color( handle, some_dude, &JL_DEFAULT )
ENDIF
-------------------------------------------------------------------------------
VList_Set_Status()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_Set_Status PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element,;
VALUE UINT new_status
RETURN VALUE:
LOGICAL <succeeded>
<succeeded> indicates whether or not the SET occured without error. An
error usually indicates that the element doesn't exist.
DESCRIPTION:
Sets the element pointed to by 'which_element' status contents which
can be one of the following macros:
&JL_NORMAL
&JL_SKIP
&JL_HIT
&JL_HIDDEN
The internal list pointer does not move to this element, it stays at the
current location.
EXAMPLE:
IF LEFT( VList_Str( handle, which_dude ), 1 ) = "$"
VList_Set_Status( handle, which_dude, &JL_SKIP )
ELSE
VList_Set_Status( handle, which_dude, &JL_NORMAL )
ENDIF
-------------------------------------------------------------------------------
VList_Simple()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION UINT Vlist_SIMPLE PROTOTYPE
PARAMETERS VALUE LONG list_handle,;
VALUE UINT upper_row,;
VALUE UINT upper_col,;
VALUE UINT lower_row,;
VALUE UINT lower_col,;
VALUE UINT start_element,;
VALUE UINT first_element_allowed,;
VALUE UINT last_element_allowed,;
VALUE LOGICAL display_only,;
VALUE LOGICAL return_on_left_or_right_keystroke
RETURN VALUE:
UINT <element>
<element> is the element that the cursor was on when the list was exitted.
Check LASTKEY() to determine if it was a selection (&K_ENTER was LASTKEY)
or abort (&K_ESC was LASTKEY).
A return value of 0 indicates an error with the list.
DESCRIPTION:
Displays a list range from 'first_element_allowed' to 'last_element_allowed'
and allows one item to be selected by pressing the return key. If <ESC>
was pressed then the pick-list is terminated. If 'display_only' is .T.,
then the list is displayed and then immediately exitted. If
'return_on_left...' is .T. then a <RIGHT> or <LEFT> cursor key will
terminate the list. This can then be used to display parallel lists
where these keys move between them.
For 'first_element_allowed', if a 0 is sent, it is adjusted to be the
first element in the list (1). For 'last_element_allowed', if a 0
is passed as the parameter, it will be set to VLIST_MAX().
EXAMPLE:
handle = VList_Init( 40 )
DO WHILE .NOT. A_EOF( my_dbf )
VList_Add( handle, my_dbf->name )
IF my_dbf->age > 45
VList_CSet_Color( handle, over_hill_color )
ENDIF
!my_dbf SKIP
ENDDO
FILL( 4, 3, 19, 47, &double_box, " ", border_color, __color_std, 6 )
selection = VList_Simple( handle, 5, 5, 17, 44, selection, 1, 0,;
.F., .F. )
-------------------------------------------------------------------------------
VList_Skip()
-------------------------------------------------------------------------------
PROTOTYPE:
PROCEDURE Vlist_Skip PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_way
RETURN VALUE:
- none -
DESCRIPTION:
Moves the internal list pointer either forward or backward 1 element. If
the element is at the end of the list, it is moved past the end of the list
and VLIST_BOL() would return .T. If the element is at the top of the list
and it is moved back 1, then it is move to non-existant element 0 and
VLIST_TOL() would return .T.
For the 'which_way' parameter, you can substitute &JL_FORWARD or
&JL_BACKWARD.
EXAMPLE:
last_found = 0
DO WHILE SUBSTR( VList_CStr( handle ), 20, 5 ) = "80003"
last_found = VList_Number( handle )
VList_Skip( handle, &JL_FORWARD )
ENDDO
IF last_found <> 0
VList_GOTO( handle, last_found )
? "The last element using the zipcode 80003 is #" + I_STR( ;
VList_Number( handle ) )
ENDIF
-------------------------------------------------------------------------------
VList_Sort()
-------------------------------------------------------------------------------
PROTOTYPE:
PROCEDURE Vlist_Sort PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT start_element,;
VALUE UINT end_element
RETURN VALUE:
- none -
DESCRIPTION:
Sorts a list alpha-numerically by using the entire string contents as
the key. This can work on either the entire list by sending either the
last element number in 'end_element' or a 0. A 0 in 'start_element' is
changed to a 1, and in 'end_element' is changed to a VLIST_MAX().
EXAMPLE:
*- sort part of the list
VList_Sort( handle, 10, 50 )
*- sort the first part
VList_Sort( handle, 1, 9 )
*- sort to the end
VList_Sort( handle, 51, 0 )
-------------------------------------------------------------------------------
VList_Sort_SubStr()
-------------------------------------------------------------------------------
PROTOTYPE:
PROCEDURE Vlist_Sort_SubStr PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT start_element,;
VALUE UINT end_element,;
VALUE UINT start_sub_string,;
VALUE UINT end_sub_string
RETURN VALUE:
- none -
DESCRIPTION:
Sorts a list alpha-numerically by using only a partial string from the
element as the key. This can work on either the entire list by sending
either the last element number in 'end_element' or a 0. A 0 in
'start_element' is changed to a 1, and in 'end_element' is changed to
a VLIST_MAX().
The substring should be the start character and end character in the
element. The start and end of 3 and 8 for the following string would
produce "FRED M".
"I FRED MACMURRAY BEING OF SOUND MIND"
EXAMPLE:
*- sort the whole list, for the 2nd to 13th character. This is a
* list containing say, filenames. The first character is used to
* mark a filename, so I don't want to sort based on it!
VList_Sort_SubStr( handle, 0, 0, 2, 13 )
-------------------------------------------------------------------------------
VList_Str()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION CHAR Vlist_Str PROTOTYPE
PARAMETERS VALUE LONG handle,;
VALUE UINT which_element
RETURN VALUE:
CHAR <contents>
<contents> is the string contents of the element.
DESCRIPTION:
Returns the string contents of element 'which_element'. This does
not move the internal list pointer, it remains on the current element.
EXAMPLE:
? "Current Element:"
? " " + VList_CStr( handle )
?
? "Element 15:"
? " " + VList_Str( handle, 15 )
-------------------------------------------------------------------------------
VList_TOL()
-------------------------------------------------------------------------------
PROTOTYPE:
FUNCTION LOGICAL Vlist_TOL PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
LOGICAL <at_top>
<at_top> is .T. if the internal list pointer is before the first element,
actually non-existant element 0. Else it is set to .F.
DESCRIPTION:
Is similar to the database related A_BOF() and returns a logical .T.
if the list's internal pointer is BEFORE the top of the list.
EXAMPLE:
? "The list in reverse order is:"
?
VList_Bottom( handle )
DO WHILE .NOT. VList_TOL( handle )
? VList_CStr( handle )
VList_Skip( handle, &JL_BACKWARD )
ENDDO
-------------------------------------------------------------------------------
VList_Top()
-------------------------------------------------------------------------------
PROTOTYPE:
PROCEDURE Vlist_Top PROTOTYPE
PARAMETERS VALUE LONG handle
RETURN VALUE:
- none -
DESCRIPTION:
Moves the internal list pointer to the top (element 1) of the list.
EXAMPLE:
VList_Top( handle )
? "The first element is: " + Vlist_CStr( handle )
==============================================================================
<<<CONTINUED IN VLIST4.DOC>>>
==============================================================================