/*Creates a list of files matching the search criteria*/



/*Begin clearing the LISTSUBDIRECTORIES list box, setting its initial position and size and disabling and hiding it*/
/* Delete all items LISTSUBDIRECTORIES List Box */
CALL VpDeleteItem window,'LISTSUBDIRECTORIES','ALL'
/* Set item position/size LISTSUBDIRECTORIES List Box */
CALL VpItem window,'LISTSUBDIRECTORIES','SETITEMPOS',ListSubdirectories_xPosition,200,ListSubdirectories_xSize,128
/* Disable item LISTSUBDIRECTORIES List Box */
CALL VpItem window,'LISTSUBDIRECTORIES','DISABLE'
/* Hide item LISTSUBDIRECTORIES List Box */
CALL VpItem window,'LISTSUBDIRECTORIES','HIDE'
/*End clearing the LISTSUBDIRECTORIES list box, setting its initial position and size and disabling and hiding it*/



/*Begin disabling and hiding the LISTSUBDIRECTORIESLABEL label*/
/* Disable item LISTSUBDIRECTORIESLABEL Text */
CALL VpItem window,'LISTSUBDIRECTORIESLABEL','DISABLE'
/* Hide item LISTSUBDIRECTORIESLABEL Text */
CALL VpItem window,'LISTSUBDIRECTORIESLABEL','HIDE'
/*End disabling and hiding the LISTSUBDIRECTORIESLABEL label*/



/*Begin clearing the LISTFILES list box, setting its initial position and size and enabling and showing it*/
SELECT
	WHEN SelectType = "Single" THEN DO
		/* Delete all items LISTFILES List Box */
		CALL VpDeleteItem window,'LISTFILES','ALL'
		/* Set item position/size LISTFILES List Box */
		CALL VpItem window,'LISTFILES','SETITEMPOS',ListFiles_xPosition,200,ListFiles_xSize,128
		/* Enable item LISTFILES List Box */
		CALL VpItem window,'LISTFILES','ENABLE'
		/* Show item LISTFILES List Box */
		CALL VpItem window,'LISTFILES','SHOW'
	END	/*Ends "WHEN SelectType = "Single" THEN DO" Section*/

	WHEN SelectType = "Multiple" & Index = 1 THEN DO
		TotalDesiredFiles = 0
		/* Delete all items LISTFILES List Box */
		CALL VpDeleteItem window,'LISTFILES','ALL'
		/* Set item position/size LISTFILES List Box */
		CALL VpItem window,'LISTFILES','SETITEMPOS',ListFiles_xPosition,200,ListFiles_xSize,128
		/* Enable item LISTFILES List Box */
		CALL VpItem window,'LISTFILES','ENABLE'
		/* Show item LISTFILES List Box */
		CALL VpItem window,'LISTFILES','SHOW'
	END	/*Ends "WHEN SelectType = "Multiple" & Index = 1 THEN DO" Section*/

	OTHERWISE NOP
END	/*Ends "SELECT" Section*/
/*End clearing the LISTFILES list box, setting its initial position and size and enabling and showing it*/



/*Begin enabling and showing the LISTFILESLABEL label*/
/* Enable item LISTFILESLABEL Text */
CALL VpItem window,'LISTFILESLABEL','ENABLE'
/* Show item LISTFILESLABEL Text */
CALL VpItem window,'LISTFILESLABEL','SHOW'
/*End enabling and showing the LISTFILESLABEL label*/



/*Begin constructing the text for the LISTFILES Label*/
SELECT
	WHEN DesiredFiles.0 = 1 & (SysFileTreeOption = "FS" | SysFileTreeOption = "F") THEN SearchType = "file"

	WHEN DesiredFiles.0 = 1 & (SysFileTreeOption = "DS" | SysFileTreeOption = "D") THEN SearchType = "directory"

	WHEN SysFileTreeOption = "FS" | SysFileTreeOption = "F" THEN SearchType = "files"

	WHEN SysFileTreeOption = "DS" | SysFileTreeOption = "D" THEN SearchType = "directories"

	OTHERWISE NOP	
END


SELECT
	WHEN SelectType = "Single" THEN DO
		SELECT
			WHEN DesiredFiles.0 > 1 THEN ListFilesLabelText = "The following "DesiredFiles.0" "SearchType" match the search criteria:"

			WHEN DesiredFiles.0 = 1 THEN ListFilesLabelText = "The following "DesiredFiles.0" "SearchType" matches the search criteria:"

			WHEN DesiredFiles.0 = 0 THEN ListFilesLabelText = "There are no "SearchType" that match the search criteria."

			OTHERWISE NOP
		END	/*Ends "SELECT" Section*/
	END	/*Ends "WHEN SelectType = "Single" THEN DO" Section*/

	WHEN SelectType = "Multiple" THEN DO
		TotalDesiredFiles = TotalDesiredFiles + DesiredFiles.0
		SELECT
			WHEN TotalDesiredFiles > 0 THEN ListFilesLabelText = "The following "TotalDesiredFiles" "SearchType" match the search criteria:"

			WHEN TotalDesiredFiles = 0 THEN ListFilesLabelText = "There are no "SearchType" that match the search criteria."

			OTHERWISE NOP
		END	/*Ends "SELECT" Section*/
	END	/*Ends "WHEN SelectType = "Multiple" THEN DO" Section*/

	OTHERWISE NOP
END	/*Ends "SELECT" Section*/
/*End constructing the text for the LISTFILES Label*/



/*Begin calculating the ySize of the LISTFILES List Box*/
/*Begin calculating the yPosition of the LISTFILESLABEL label*/
SELECT
	WHEN SelectType = "Single" THEN DO
		SELECT
			WHEN DesiredFiles.0 < 7 THEN ListFilesySize = 134

			WHEN DesiredFiles.0 > 6 & DesiredFiles.0 < 20 THEN DO
				Delta = DesiredFiles.0 - 6
				ListFilesySize = 48 + 8*Delta
				ListFilesySize = ListFilesySize*2.8%1
			END	/*Ends "DesiredFiles.0 > 6 & DesiredFiles.0 < 20 THEN DO" Section*/

			OTHERWISE ListFilesySize = 510
		END	/*Ends "SELECT" Section*/
	END	/*Ends "WHEN SelectType = "Single" THEN DO" Section*/

	WHEN SelectType = "Multiple" THEN DO
		SELECT
			WHEN TotalDesiredFiles < 7 THEN ListFilesySize = 134

			WHEN TotalDesiredFiles > 6 & TotalDesiredFiles < 20 THEN DO
				Delta = TotalDesiredFiles - 6
				ListFilesySize = 48 + 8*Delta
				ListFilesySize = ListFilesySize*2.8%1
			END	/*Ends "TotalDesiredFiles > 6 & TotalDesiredFiles < 20 THEN DO" Section*/

			OTHERWISE ListFilesySize = 510
		END	/*Ends "SELECT" Section*/
	END	/*Ends "WHEN SelectType = "Multiple" THEN DO" Section*/

	OTHERWISE NOP
END	/*Ends "SELECT" Section*/
/*End calculating the ySize of the LISTFILES List Box*/
ListFilesyPosition = 362
ListFilesLabelyPosition = 3 + ListFilesyPosition + ListFilesySize
/*End calculating the yPosition of the LISTFILESLABEL label*/
/*End calculating the ySize of the LISTFILES List Box*/



/*Begin setting the yPosition of the LISTFILESLABEL Label and the ySize of the LISTFILES list box*/
/* Set item position/size LISTFILESLABEL Text */
ListSubdirectoriesLabelxPosition = 50
ListSubdirectoriesLabelxSize = ListSubdirectories_xSize + (ListSubdirectories_xPosition - ListSubdirectoriesLabelxPosition)
CALL VpItem window,'LISTFILESLABEL','SETITEMPOS',ListSubdirectoriesLabelxPosition,ListFilesLabelyPosition,ListSubdirectoriesLabelxSize,22
/* Set item position/size LISTFILES List Box */
CALL VpItem window,'LISTFILES','SETITEMPOS',ListFiles_xPosition,ListFilesyPosition,ListFiles_xSize,ListFilesySize
/*End setting the yPosition of the LISTFILESLABEL Label and the ySize of the LISTFILES list box*/



/*Begin clearing, disabling and hiding the SEEKTEXT Label*/
/* Set item value SEEKTEXT Text */
CALL VpSetItemValue window,'SEEKTEXT',""
/* Disable item SEEKTEXT Text */
CALL VpItem window,'SEEKTEXT','DISABLE'
/* Hide item SEEKTEXT Text */
CALL VpItem window,'SEEKTEXT','HIDE'
/*End clearing, disabling and hiding the SEEKTEXT Label*/



/*Begin enabling, showing and setting the value of the OTHERSERVICESRADIOBUTTON radio button*/
/* Enable item OTHERSERVICESRADIOBUTTON Radio Button */
CALL VpItem window,'OTHERSERVICESRADIOBUTTON','ENABLE'
/* Show item OTHERSERVICESRADIOBUTTON Radio Button */
CALL VpItem window,'OTHERSERVICESRADIOBUTTON','SHOW'
	
IF SysFileTreeOption = "FS" | SysFileTreeOption = "F" THEN OtherServicesText = "Highlight the files desired for other services. Double click to initiate, or press this radio button."
IF SysFileTreeOption = "DS" | SysFileTreeOption = "D" THEN OtherServicesText = "Highlight the directories desired for other services. Double click to initiate, or press this radio button."

/* Set item value OTHERSERVICESRADIOBUTTON Radio Button */
CALL VpSetItemValue window,'OTHERSERVICESRADIOBUTTON',OtherServicesText
/*End enabling, showing and setting the value of the OTHERSERVICESRADIOBUTTON radio button*/



/*Begin adding the text to the LISTFILESLABEL Label*/
/* Set item value LISTFILESLABEL Text */
CALL VpSetItemValue window,'LISTFILESLABEL',ListFilesLabelText
/*End adding the text to the LISTFILESLABEL Label*/



/*Begin setting the size and position of the GOUP radio button and then disabling and hiding it*/
/* Set item value GOUP Radio Button */
CALL VpSetItemValue window,'GOUP',UpLevel
/* Set item position/size GOUP Radio Button */
GOUPxPosition = 74
ListSubdirectoriesyPosition = 200
ListSubdirectoriesySize = 128
ListSubdirectoriesLabelyPosition = 3 + ListSubdirectoriesyPosition + ListSubdirectoriesySize
GOUPyPosition = ListSubdirectoriesLabelyPosition + 30
GOUPxSize = ListSubdirectories_xSize + (ListSubdirectories_xPosition - GOUPxPosition)
CALL VpItem window,'GOUP','SETITEMPOS',GOUPxPosition,GOUPyPosition,GOUPxSize,22
/* Disable item GOUP Radio Button */
CALL VpItem window,'GOUP','DISABLE'
/* Hide item GOUP Radio Button */
CALL VpItem window,'GOUP','HIDE'
/*End hiding and setting the size and position of the GOUP radio button and then disabling and hiding it*/



/*Begin adding the filenames to the LISTFILES List Box*/
SELECT
	WHEN DesiredFiles.0 > 0 THEN DO
		/* Add items from list LISTFILES List Box */
		index=VpAddItem(window, 'LISTFILES', 'LIST', 'DesiredFiles.')
		NOP
	END	/*Ends "WHEN DesiredFiles.0 > 0 THEN DO" Section*/

	OTHERWISE NOP
END	/*Ends "SELECT" Section*/
SelectedIndices.0 = 0
RadioButtonSelect = "NO"
ManualDeSelect = "NO"
HighLightRow1 = 1
HighLightRow2 = DesiredFiles.0
DeHighLightRow1 = 1
DeHighLightRow2 = DesiredFiles.0
/*End adding the filenames to the LISTFILES List Box*/



/*Begin enabling and showing the SEEK and CCANCEL push buttons and setting the text on the SEEK and CCANCEL push button*/
/* Enable item SEEK Push Button */
CALL VpItem window,'SEEK','ENABLE'
/* Show item SEEK Push Button */
CALL VpItem window,'SEEK','SHOW'
/* Set item value SEEK Push Button */
CALL VpSetItemValue window,'SEEK',"Do Another"
/* Enable item CCANCEL Push Button */
CALL VpItem window,'CCANCEL','ENABLE'
/* Show item CCANCEL Push Button */
CALL VpItem window,'CCANCEL','SHOW'
/* Set item value CCANCEL Push Button */
CALL VpSetItemValue window,'CCANCEL',"End Program"
/*End enabling and showing the SEEK and CCANCEL push buttons and setting the text on the SEEK and CCANCEL push buttons*/



/*Begin setting the variable, ListType, to "Files"*/
ListType = "Files"
/*End setting the variable, ListType, to "Files"*/
RETURN