Jump to content

ListBox Veri Yazdırmak


djonur007

Recommended Posts

Page On Show kodu:

nToplam = ListBox.GetCount("ListBox1")

if nToplam ~= 0 then

nSayi = 0

repeat ListBox.DeleteItem("ListBox1", 1)

nSayi = nSayi+1

if nSayi == nToplam then

break;

end

until nSayi == nToplam

end

tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil)

if tDosyalar ~= nil then

for i in pairs(tDosyalar) do

ListBox.AddItem("ListBox1", tDosyalar, "")

end

end

Bu kodlar C:\a\dosya.exe seklinde tam yolu gösterek ekler sadece dosya adını eklemek isterseniz şunu kullanın:

nToplam = ListBox.GetCount("ListBox1")

if nToplam ~= 0 then

nSayi = 0

repeat ListBox.DeleteItem("ListBox1", 1)

nSayi = nSayi+1

if nSayi == nToplam then

break;

end

until nSayi == nToplam

end

tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil)

if tDosyalar ~= nil then

for i in pairs(tDosyalar) do

tAyir = String.SplitPath(tDosyalar)

ListBox.AddItem("ListBox1", tAyir.Filename, "")

end

end

Link to comment
Share on other sites

tabii ki ekletebilirsin.

tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil)

yerine

tDosyalar = File.Find("c:\\a", "*.*", true, false, nil, nil)

kodunu kulalnırsan alt klasorlerdeki dosyalarıda arar ve ekler

Eğer çok dosya varsa ve uzun sürüyorsa şu şekilde progressde gösterebilirsin:

StatusDlg.Show()

File.Find

StatusDlg.Hide()

Link to comment
Share on other sites

hatta ve hatta kodları şu şekilde düzenlersen normal progress de gösterebilirsin:

nToplam = ListBox.GetCount("ListBox1")

if nToplam ~= 0 then

nSayi = 0

repeat ListBox.DeleteItem("ListBox1", 1)

nSayi = nSayi+1

if nSayi == nToplam then

break;

end

until nSayi == nToplam

end

tDosyalar = File.Find("c:\\Windows", "*.*", true, false, nil, nil)

Progress.SetCurrentPos("Progress1", 0)

nSay = Table.Count(tDosyalar)

Progress.SetRange("Progress1", 1, nSay)

if tDosyalar ~= nil then

for i in pairs(tDosyalar) do

tAyir = String.SplitPath(tDosyalar)

ListBox.AddItem("ListBox1", tAyir.Filename, "")

nPos = Progress.GetCurrentPos("Progress1")

Progress.SetCurrentPos("Progress1", nPos+1)

end

end

Link to comment
Share on other sites

Peki c:\a\b\c\d\.... şeklinde klasörler varsa ve bu klasörlerin için dosyalar varsa bunları yazdıramaz mıyız?

Kintaronun verdiğine ek olarak;

tDosyaBul = File.Find("C:\\a", "*.*", true, false, nil, nil)
if tDosyaBul then
	Progress.SetRange("Progress", 0, #tDosyaBul); --Menzil belirle
	StatusDlg.SetMeterRange(0, #tDosyaBul); --Menzil belirle
	StatusDlg.SetTitle("Aranıyor..");
	StatusDlg.ShowCancelButton(true, "Durdur"); --İptal butonunu göster
	StatusDlg.Show(MB_ICONNONE, false); --Status penceresini göster
	Table.Sort(tDosyaBul, nil); --tDosyaBul tablosunu harf'e göre küçükten büyüğe sırala

		Progress.SetVisible("Progress",	true); --Progress göster
		ListBox.SetUpdate("Bulunan", 	false);--Listbox ekleneceği sırada görünürlüğü kapat
		for a, t in pairs(tDosyaBul) do
			tYol = String.SplitPath(t);    --Yolu parçala
			ListBox.AddItem("Bulunan", tYol.Filename .. tYol.Extension, ""); --Listboxa ekle
			Progress.SetCurrentPos("Progress", a); --Progress pozisyonunu belirle
			StatusDlg.SetMeterPos(a); --Status pozisyonunu belirle
			Progress.SetText("Progress", t); --Progress yazısını belirle
			StatusDlg.SetStatusText("Bulunan: " .. t); --Status yazısını belirle
			if StatusDlg.IsCancelled() == true then --Eğer durdura basılmışsa aşağıya geç
				if Dialog.Message("", "Arama işlemi durdurulsun mu?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1) == IDYES then --Evet denilirse aşağıya geç
				break; --Döngüyü durdur
				end
			end
		end
		ListBox.SetUpdate("Bulunan", 	true); --Listbox görünürlüğünü aç
		Progress.SetVisible("Progress", false);--Progress göster
		StatusDlg.Hide();--Status penceresini gizle
end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...