como add files to lisbox & File.Find

This english section.
hi
como add all fonts in listbox
my code
count=0
function found()
count=count+1;
File.Find(_SourceFolder, "*.ttf", false, false, nil, nil);
ListBox.AddItem("ListBox1",tab[1], "data "..count);
return true
end

tab=File.Find(_SourceFolder, "*.ttf", false, false, nil, found);
for i in pairs(tab) do
--ListBox.AddItem("ListBox1",tab[1], "data"..i);
--ListBox.SetItemText("ListBox1", i, tab[1])
ListBox.SetItemCheck("ListBox1", i, BST_CHECKED);

end
not work !!
and how work for ??

for i:=0 to listbox.items.count-1 do
in AMS how do that
I created these functions and an example for you, I hope it will be helpful;)
You should use this forum Español Section "for queries in this language.
sorry my English
function adfilessbydirectory(sourceFilesPath,ListBoxObjName,file)
if type(sourceFilesPath) == "string" and type(ListBoxObjName) == "string" and type(file)== "string"then
tfiles = File.Find(sourceFilesPath, file, false, false, nil, nil);
	if tfiles then
		for i,sPath in pairs(tfiles)do
			spl = String.SplitPath(sPath)
			sFile=spl.Filename..spl.Extension;
			ListBox.AddItem(ListBoxObjName,sFile,sPath);
		end
			return true;
	else
			return false;
	end
else
	return false;
end
end


function checkUncheckListboxall(ListBoxObjName,check)
	if type(check) == "boolean" and type(ListBoxObjName) == "string" then
	if check then
		check = BST_CHECKED;
	else
		check = BST_UNCHECKED;
	end
	ncount = ListBox.GetCount(ListBoxObjName);
		if ncount > 0 then
		for i = 1,ncount do
			ListBox.SetItemCheck(ListBoxObjName,i,check);
		end
			return check;
		end
	
	else
		return nil;
	end
	
end
Example:

http://www.multiupload.com/1HCTTXXZSO
rafaxplayer escribió:I created these functions and an example for you, I hope it will be helpful;)
You should use this forum Español Section "for queries in this language.
sorry my English
function adfilessbydirectory(sourceFilesPath,ListBoxObjName,file)
if type(sourceFilesPath) == "string" and type(ListBoxObjName) == "string" and type(file)== "string"then
tfiles = File.Find(sourceFilesPath, file, false, false, nil, nil);
	if tfiles then
		for i,sPath in pairs(tfiles)do
			spl = String.SplitPath(sPath)
			sFile=spl.Filename..spl.Extension;
			ListBox.AddItem(ListBoxObjName,sFile,sPath);
		end
			return true;
	else
			return false;
	end
else
	return false;
end
end


function checkUncheckListboxall(ListBoxObjName,check)
	if type(check) == "boolean" and type(ListBoxObjName) == "string" then
	if check then
		check = BST_CHECKED;
	else
		check = BST_UNCHECKED;
	end
	ncount = ListBox.GetCount(ListBoxObjName);
		if ncount > 0 then
		for i = 1,ncount do
			ListBox.SetItemCheck(ListBoxObjName,i,check);
		end
			return check;
		end
	
	else
		return nil;
	end
	
end
Example:

http://www.multiupload.com/1HCTTXXZSO
thank you very match :friends:
Spanglish