$CLASSNAME$
	LISTITEM
$SUMMARY$
	Class are destined to control of
	associated in list data values. For example, it can be list of files.
$LANG_RU$
	    ,   .
	,     .
$ABOUT$
	Class are destined to control of
	associated in list data values. For example, it can be list of files.
$LANG_RU$
	    ,   .
	,     .
$SYNTAX$
	ListItemNew(<nLrow>,<nLcol>,<nRrow>,<nRcol>[,<nColumns>[,<sDelimiter>[,<sColor>]]]) --> ListItem object
$ATTRIBUTES$
	<ClassName> 	LISTITEM
	<Item>		Array, array of data value
	<nTop> 		Numeric, a LISTITEM viewport coordinates
	<nLeft>         Numeric, a LISTITEM viewport coordinates
	<nBottom>       Numeric, a LISTITEM viewport coordinates
	<nRight>        Numeric, a LISTITEM viewport coordinates
	<ColorSpec>	String, color specification.

			"clr1, clr2, clr3, clr4, clr5, clr6, clr7"
			clr1 - border and items color
			clr2 - current item colors if object in focus
			clr3 - current item colors if object outof focus
			clr4 - title colors
			clr5 - selected item colors
			clr6 - current selected item colors
			clr7 - founded symbol colors


	<ItemCount>	Numeric, items count
	<Buffer>	Numeric, the cuurent items number
	<First>		Numeric, the number of first element into viewport
	<ItemWin>	Numeric, items into viewport
	<Line>		Numeric, a current cursor coordinates - line
	<Col>		Numeric, a current cursor coordinates - column
	<Pos>		Numeric, a current column
	<ColWin>	Numeric, a number columns into viewport
	<RowWin>	Numeric, a number rows into viewport
	<LenCol>	Array, array with columns width
	<Title>		Array, array of string that contain columns titles
	<Delim>		String, columns delimiters
	<HasFocus>	Logical, is TRUE if object in focus
	<FindBuffer>	String, the find buffer

$LANG_RU$
	<ClassName> 	LISTITEM
	<Item>		Array,  .
	<nTop> 		Numeric,    LISTITEM
	<nLeft>         Numeric,    LISTITEM
	<nBottom>       Numeric,    LISTITEM
	<nRight>        Numeric,    LISTITEM
	<ColorSpec>	String,  .

			"clr1, clr2, clr3, clr4, clr5, clr6, clr7"
			clr1 -     
			clr2 -   ,    
			clr3 -   ,     
			clr4 -  
			clr5 -   
			clr6 -    
			clr7 -     

	<ItemCount>	Numeric,    <::Item>
	<Buffer>	Numeric,   
	<First>		Numeric,      
	<ItemWin>	Numeric,     
	<Line>		Numeric,    - 
	<Col>		Numeric,    - 
	<Pos>		Numeric,   
	<ColWin>	Numeric,     
	<RowWin>	Numeric,     
	<LenCol>	Array, ,   
	<Title>		Array,   
	<Delim>		String,  
	<HasFocus>	Logical,  TRUE    
	<FindBuffer>	String,  

$METHODNAME$
	ListItemNew()
$SUMMARY$
	LISTITEM object constructor.
$LANG_RU$
	  LISTITEM.
$SYNTAX$
	ListItemNew(<nLrow>,<nLcol>,<nRrow>,<nRcol>[,<nColumns>[,<sDelimiter>[,<sColor>]]]) --> ListItem object
$ARGUMENTS$
	<nLrow> 	Numeric, a object coordinates
	<nLcol>		Numeric, a object coordinates
	<nRrow>		Numeric, a object coordinates
	<nRcol>		Numeric, a object coordinates
	<nColumns>	Numeric, a number columns into viewport. By default 1.
	<sDelimiter>	String, a columns delimiter. By default <|>
	<sColor>	String, a colors specification. By default "7/0, 7/0, 7/0, 7/0, 7/0, 7/0, 7/0"
$LANG_RU$
	<nLrow> 	Numeric,   
	<nLcol>		Numeric,   
	<nRrow>		Numeric,   
	<nRcol>		Numeric,   
	<nColumns>	Numeric,  .   1.
	<sDelimiter>	String,  .   <|>
	<sColor>	String,  .   "7/0, 7/0, 7/0, 7/0, 7/0, 7/0, 7/0"
$RETURNS$
	Method returns new LISTITEM object.
$LANG_RU$
	    LISTITEM.
$DESCRIPTION$
	ListItemNew() is constructs and returns new LISTITEM object.
	That class can be used to edit, view, control associated in list data.
$LANG_RU$
	ListItemNew()     LISTITEM.
	       , ,
	 ,   .
$ENDMETHOD$

$METHODNAME$
	Down()
$SUMMARY$
	Goes next element.
$LANG_RU$
	    .
$SYNTAX$
	Down() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Down() is moves cursor to next element of <::Item>.
$LANG_RU$
	Down()       <::Item>.
$ENDMETHOD$

$METHODNAME$
	Up()
$SUMMARY$
	Goes previous element.
$LANG_RU$
	   .
$SYNTAX$
	Up() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Up() is moves cursor to previouse  element of <::Item>.
$LANG_RU$
	Up()       <::Item>.
$ENDMETHOD$


$METHODNAME$
	Left()
$SUMMARY$
	Goes to left.
$LANG_RU$
	 .
$SYNTAX$
	Left() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Left() is moves cursor to left of current column.
	The new current element will be <::Buffer> - <::RowWin>.
$LANG_RU$
	Left()       .
	    <::Buffer> - <::RowWin>.
$ENDMETHOD$

$METHODNAME$
	Right()
$SUMMARY$
	Goes to right.
$LANG_RU$
	 .
$SYNTAX$
	Right() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Right() is moves cursor to right of current column.
	The new current element will be <::Buffer> + <::RowWin>.
$LANG_RU$
	Right()       .
	    <::Buffer> + <::RowWin>.
$ENDMETHOD$

$METHODNAME$
	Home()
$SUMMARY$
	Goes to first element of array <::Item>.
$LANG_RU$
	     <::Item>
$SYNTAX$
	Home() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Home() is moves cursor to the first element of <::Item> listing.
	The new current element will be 1.
$LANG_RU$
	Home()       <::Item>.
	    1.
$ENDMETHOD$

$METHODNAME$
	End()
$SUMMARY$
	Goes to last element of array <::Item>.
$LANG_RU$
	     <::Item>
$SYNTAX$
	End() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	End() is moves cursor to the last element of <::Item> listing.
	The new current element will be len(<::Item>).
$LANG_RU$
	End()       <::Item>.
	    len(<::Item>).
$ENDMETHOD$

$METHODNAME$
	PageDown()
$SUMMARY$
	Goes to next page of array <::Item>.
$LANG_RU$
	     <::Item>
$SYNTAX$
	PageDown() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	PageDown() is moves cursor to the next page  of <::Item> listing.
	The size of page is <::ItemWin>. The current element will be <::Buffer>+<::ItemWin>.
$LANG_RU$
	PageDown()        <::Item>.
	  -  <::ItemWin>.    <::Buffer>+<::ItemWin>.
$ENDMETHOD$

$METHODNAME$
	PageUp()
$SUMMARY$
	Goes to previouse page of array <::Item>.
$LANG_RU$
	     <::Item>
$SYNTAX$
	PageUp() 	--> NIL
$ARGUMENTS$

$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	PageUp() is moves cursor to the previouse page of <::Item> listing.
	The size of page is <::ItemWin>. The current element will be <::Buffer>-<::ItemWin>.
$LANG_RU$
	PageUp()       <::Item>.
	  -  <::ItemWin>.    <::Buffer>-<::ItemWin>.
$ENDMETHOD$


$METHODNAME$
	AddItem()
$SUMMARY$
	Add new element to listing.
$LANG_RU$
	    .
$SYNTAX$
	AddItem(<vData>[, <sColor>][, <sSelColor>]) 	--> 0 || 1
$ARGUMENTS$
	<vData> - a data value
	<sColor> - the base element colors
	<sSelColor> - the selected element colors
$LANG_RU$
	<vData> -   .
	<sColor> -     .
	<sSelColor> -   .
$RETURNS$
	Returns 1 if element will be added.
$LANG_RU$
	 1,   .
$DESCRIPTION$
	AddItem() added new element to the end listing <::Item>.
$LANG_RU$
	AddItem()       <::Item>.
$ENDMETHOD$

$METHODNAME$
	InsItem()
$SUMMARY$
	Insert new element into listing.
$LANG_RU$
	    .
$SYNTAX$
	InsItem(<vData>, <nPos>[, <sColor>][, <sSelColor>][, <lSelected>]) 	--> 0 || 1
$ARGUMENTS$
	<vData> - a data value
	<nPos> - a new elements position
	<sColor> - the base element colors
	<sSelColor> - the selected element colors
	<lSelected> - if TRUE, element will be selected (by default FALSE)
$LANG_RU$
	<vData> -   .
	<nPos> -    
	<sColor> -     .
	<sSelColor> -   .
	<lSelected> -  TRUE,      (  FALSE).
$RETURNS$
	Returns 1 if element will be inserted.
$LANG_RU$
	 1,   .
$DESCRIPTION$
	InsItem() inserted new element <vData> into  listing <::Item>. New element inserted
	at position <nPos>. Before insertion, size of <::Item> increased by 1 and all
	elements with <nPos> shifted down one elemen.
$LANG_RU$
	InsItem()    <vData>   <::Item>.  
	  <nPos>   .  ,  <::Item> 
	 1      <nPos>   .
$ENDMETHOD$

$METHODNAME$
	DelItem()
$SUMMARY$
	Delete an listing element.
$LANG_RU$
	   .
$SYNTAX$
	DelItem(<nPos>) 	--> 0 || 1
$ARGUMENTS$
	<nPos> - a elements position
$LANG_RU$
	<nPos> -    
$RETURNS$
	Returns 1 if element will be deleted.
$LANG_RU$
	 1,   .
$DESCRIPTION$
	DelItem() is deletes an element <nPos> from an listing <::Item>. The contents of the
	element is lost, and all elements from <nPos>+1 position shifted up one element.
	The last element in the array discarded.
$LANG_RU$
	DelItem()     <nPos>   <::Item>. 
	        <nPos>+1  
	  1 .     .
$ENDMETHOD$

$METHODNAME$
	GetItem()
$SUMMARY$
	Gets current item.
$LANG_RU$
	  .
$SYNTAX$
	GetItem() 	--> <vData>
$ARGUMENTS$
$RETURNS$
	Returns data value of current element.
$LANG_RU$
	   .b
$DESCRIPTION$
	GetItem() is gets the current element <::Buffer> into listing <::Item>.
	If array <::Item> is empty, method return NIL.
$LANG_RU$
	GetItem()    <::Buffer>  <::Item>.
	  <::Item> ,   NIL.
$ENDMETHOD$

$METHODNAME$
	SetItem()
$SUMMARY$
	Sets new current item.
$LANG_RU$
	  .
$SYNTAX$
	SetItem(<nPos>) 	--> 0 || 1
$ARGUMENTS$
	<nPos> - the number new current elements.
$LANG_RU$
	<nPos> -    .
$RETURNS$
	Returns 1 if element with number <nPos>  exist.
$LANG_RU$
	 1,     <nPos> .
$DESCRIPTION$
	SetItem() is sets new current element with number <nPos>. If <nPos> is more
	than length of <::Item>, method returns 0.
	If array <::Item> is empty, method return NIL.
$LANG_RU$
	SetItem()       <nPos>.  <nPos>
	,    ,   NIL,    
	.
$ENDMETHOD$

$METHODNAME$
	Refresh()
$SUMMARY$
	Refreshed viewport.
$LANG_RU$
	  ..
$SYNTAX$
	Refresh() 	--> NIL
$ARGUMENTS$
$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Refresh() is refreshes viewport. Called within methods of class LISTITEM
	automaticaly.
$LANG_RU$
	Refresh()   .    
	LISTITEM      .
$ENDMETHOD$

$METHODNAME$
	SetFocus()
$SUMMARY$
	Set focus to object.
$LANG_RU$
	 .
$SYNTAX$
	SetFocus() 	--> NIL
$ARGUMENTS$
$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	SetFocus() is sets focus to object of LISTITEM class. Attribute <::HasFocus> take value TRUE.
$LANG_RU$
	SetFocus()      LISTITEM. 
	<::HasFocus>   TRUE.
$ENDMETHOD$

$METHODNAME$
	KillFocus()
$SUMMARY$
	Kill focus.
$LANG_RU$
	 .
$SYNTAX$
	KillFocus() 	--> NIL
$ARGUMENTS$
$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	KillFocus() is kils focus for object of LISTITEM class. Attribute <::HasFocus> take value FALSE.
$LANG_RU$
	KillFocus()      LISTITEM. 
	<::HasFocus>   FALSE.
$ENDMETHOD$

$METHODNAME$
	Clear()
$SUMMARY$
	Remove all items from listing.
$LANG_RU$
	    .
$SYNTAX$
	Clear() 	--> NIL
$ARGUMENTS$
$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	Clear() removes all items from a <::Item> and sets counters to zero.
$LANG_RU$
	Crear()         
	 .
$ENDMETHOD$

$METHODNAME$
	ClearFindBuffer()
$SUMMARY$
	Crears find buffer.
$LANG_RU$
	  .
$SYNTAX$
	ClearFindBuffer() 	--> NIL
$ARGUMENTS$
$RETURNS$
	Returns NIL.
$LANG_RU$
	 NIL.
$DESCRIPTION$
	ClearFindBuffer() is clears find buffer. <::FindBuffer> sets to empty string.
$LANG_RU$
	CrearFindBuffer()   . <::FindBuffer>   .
$ENDMETHOD$

$METHODNAME$
	SetTitle()
$SUMMARY$
	Set columns header.
$LANG_RU$
	  .
$SYNTAX$
	SetTitle(<aTitle>) 	--> TRUE || FALSE
$ARGUMENTS$
	<aTitle>  - Array, array of columns header
$LANG_RU$
	<aTitle>  - Array,   .
$RETURNS$
	Returns TRUE if <aTitle> not empty.
$LANG_RU$
	 TRUE,  <aTitle>  .
$DESCRIPTION$
	SetTitle() is sets headers for listing columns. Headers sets for first len(<aTitle>)
	columns, the rest columns becomes empty header.
$LANG_RU$
	SetTitle()     . 
	   len(<aTitle>) ,  
	   .
$ENDMETHOD$

$METHODNAME$
	DrawTitle()
$SUMMARY$
	Draw columns header.
$LANG_RU$
	  .
$SYNTAX$
	DrawTitle() 	--> TRUE
$ARGUMENTS$
$RETURNS$
	Returns TRUE.
$LANG_RU$
	 TRUE.
$DESCRIPTION$
	DrawTitle() is drew headers for listing columns.
$LANG_RU$
	DrawTitle()   .
$ENDMETHOD$

$METHODNAME$
	SetColumns()
$SUMMARY$
	Set columns count.
$LANG_RU$
	  .
$SYNTAX$
	SetColumns(<nCol>) 	--> TRUE || FALSE
$ARGUMENTS$
	<nCol> - Numeric, the columns count
$LANG_RU$
	<nCol> - Numeric,  
$RETURNS$
	Returns TRUE i success.
$LANG_RU$
	 TRUE    .
$DESCRIPTION$
	SetColumns() is sets columns count and sets new balanced width  for all columns.
$LANG_RU$
	SetColumns()          
	.
$ENDMETHOD$

$METHODNAME$
	SetWidthCol()
$SUMMARY$
	Set columns width.
$LANG_RU$
	  .
$SYNTAX$
	SetWidthCol(<aWidth>) 	--> TRUE || FALSE
$ARGUMENTS$
	<aWidth> - Array, array of width for columns
$LANG_RU$
	<aWidth> - Array, ,   .
$RETURNS$
	Returns TRUE in success.
$LANG_RU$
	 TRUE    .
$DESCRIPTION$
	SetWidthCol() is sets columns width. If <aWidth[i]>==0, for column with
	number <i> automaticaly sets balanced width.
$LANG_RU$
	SetWidthCol()     .  <aWidth[i]>==0,
	     <i>   .
$ENDMETHOD$

$METHODNAME$
	Select()
$SUMMARY$
	Select item.
$LANG_RU$
	 .
$SYNTAX$
	Select([<vItem>]) 	--> TRUE
$ARGUMENTS$
	<vItem> - Array or Numeric, array of items numbers for selection or items number. (By default current item <::Buffer>)
$LANG_RU$
	<vItem> - Array or Numeric,      
	   . (     <::Buffer>)
$RETURNS$
	Returns TRUE.
$LANG_RU$
	 TRUE.
$DESCRIPTION$
	Select() is sets selected (one or more) items of listing <::Item>.
$LANG_RU$
	Select()        <::Item>
$ENDMETHOD$

$METHODNAME$
	GetSelected()
$SUMMARY$
	Returns selected items numbers.
$LANG_RU$
	   .
$SYNTAX$
	GetSelected() 	--> <aSelectedItems>
$ARGUMENTS$
$RETURNS$
	Returns array of selected items numbers.
$LANG_RU$
	    .
$DESCRIPTION$
	GetSelected() returns array of selected items numbers.
$LANG_RU$
	GetSelected()     .
$ENDMETHOD$


$METHODNAME$
	Find()
$SUMMARY$
	Find substring.
$LANG_RU$
	 .
$SYNTAX$
	Find(<sStr>) 	--> TRUE || FALSE
$ARGUMENTS$
	<sStr> - String, substring to searching
$LANG_RU$
	<sStr> - String,   
$RETURNS$
	Returns TRUE if searching is success.
$LANG_RU$
	 TRUE   .
$DESCRIPTION$
	Find() is addes substring <sStr> to the end of find buffer <::FindBuffer> and
	searching <::FindBuffer> within <::Item>.
	If <::FindBuffer> is empty, searching start with first element of <::Item>,
	in other searching start with current position <::Buffer>.

	The <::FindBuffer> value is compared to the array element beginning with
	the leftmost character in the <::Item> element  and proceeding until there
	are no more characters left in <::FindBuffer>. If <::FindBuffer> is found
	seraching stopped, <::Buffer> sets to position founded element and Find()
	returns TRUE. If there is no match, <::Buffer> no changed, <sStr> removes from a <::FIndBuffer>
	and Find() returns FALSE.
$LANG_RU$
	Find()  <sStr>     <::FindBuffer> 
	 <::FindBuffer>   <::Item>.
	 <::FindBuffer> ,      <::Item>,
	,      <::Buffer>.

	 <::FindBuffer>        <::Item>.
	   <::FindBuffer>       .
	  <::FindBuffer> ,  , <::Buffer> 
	       <::Item>  Find()
	 TRUE.    , <::Buffer>  ,  <sStr>
	   <::FIndBuffer>  Find()  FALSE.
$ENDMETHOD$

$METHODNAME$
	SetKey()
$SUMMARY$
	Set a code block associated with code key value.
$LANG_RU$
	  ,    .
$SYNTAX$
	SetKey(<nKey>[, <bData>]) 	--> bPreviouse
$ARGUMENTS$
	<nKey> - Numeric, the key code.
	<bData> - Block code, block to runing.
$LANG_RU$
	<nKey> - Numeric,  .
	<bData> - Block code,  .
$RETURNS$
	Returns the previouse block code if exist or returns current one <bData>.
$LANG_RU$
	       <nKey>(  )
	   <bData>.
$DESCRIPTION$
	SetKey() is sets a new code block associated with code <nKey>.
	When replacing an existing code block definition, it returns previous
	code block, in other returns current one.
	Its associated key code will be evaluated HandleKey() methods.

	If <bData>  is NIL, SetKey() returns old block code and remove
	keypress/code block definition.


	A default key code is cursor moves(K_UP, K_DOWN, K_LEFT, K_RIGHT, K_PGUP,
	K_PGDN, K_HOME, K_END ....) associates with corresponded methods Left(),
	Right(), Up(), Down() and more.

	Users code block take two parameters: link to LISTITEM object and key code;
	and  can be returns one of next values:

	-1 User request for the LISTITEM to lose input focus

	0  Code block associated with <nKey> was evaluated

	1  Unable to locate <nKey> in the dictionary, key was not processed

$LANG_RU$
	SetKey()    ,    <nKey>.
	      ,   
	 ,    .
	         
	HandleKey().

	 <bData> NIL, SetKey()    
	         .

	     (K_UP, K_DOWN, K_LEFT, K_RIGHT, K_PGUP,
	K_PGDN, K_HOME, K_END ....)    Left(),
	Right(), Up(), Down()  .

	 ,     ,  
	:   LISTITEM   ;   
	   :

	-1    LISTITEM  

	0   ,    <nKey>,  

	1      <nKey>,    

$ENDMETHOD$

$METHODNAME$
	HandleKey()
$SUMMARY$
	Simple handle key.
$LANG_RU$
	 .
$SYNTAX$
	HandleKey(<nKey>) 	--> .T. || .F.
$ARGUMENTS$
	<nKey> - Numeric, specified in <inkey.ch> key code
$LANG_RU$
	<nKey> - Numeric,   <inkey.ch>  .

$RETURNS$
	Returns one of numeric value :

	-1 User request for the LISTITEM to lose input focus

	0  Code block associated with <nKey> was evaluated

	1  Unable to locate <nKey> in the dictionary, key was not processed
$LANG_RU$
	   :

	-1    LISTITEM  

	0   ,    <nKey>,  

	1      <nKey>,    
$DESCRIPTION$
	HandleKey() is evaluates code block that associated with key code
	<nKey>. The keypress/code block definition creates within SetKey() method.

	A default key code  cursor moves  associates with corresponded methods Left(),
	Right(), Up(), Down() and more of LISTITEM class.
$LANG_RU$
	HandleKey()   ,    
	<nKey>.           
	SetKey().          ,
	     LISTITEM.

$ENDMETHOD$



$EXAMPLES$

#include <inkey.ch>
#define FA_NORMAL	0
#define FA_READONLY	1
#define FA_HIDDEN	2
#define FA_SYSTEM	4
#define FA_VOLUME	8
#define FA_DIRECTORY	16
#define FA_ARCHIVE	32

clear screen
wopen(5, 5, 20, 30)
li := ListItemNew(0, 0, maxrow(), maxcol()) //  create new ListItem object
wbox()
fname = fileseek("./", FA_ARCHIVE+FA_VOLUME+FA_SYSTEM+FA_HIDDEN+FA_READONLY)
do while !empty(fname)
	li:AddItem(fname, "R/N, N/W")	// --> 1
	fname = fileseek()
enddo
li:SetKey(K_ENTER, {|oLI, nKey| alert(toString(oLI:Buffer)+ " " + oLi:GetItem())})
li:SetFocus()
do while .t.
	nKey := inkey(0)
	ret := li:HandleKey(nKey)
	if ret == -1
		exit
	endif
enddo
wclose()



$PLATFORMS$
   No dependies of platform.
$SEEALSO$
$AUTHOR$
ITK
$LASTDATE$





