Jump to content

[Soru] Checkbox İsimlerini Listboxa Yazdırmak


coxefgun
 Share

Recommended Posts

[b]Herkese selamlar. Ufak bir sorum olacak.

Kintaro nun kodlarını kullanarak çok sayfalı bir AIO hazırlıyorum. Şöyle bir niyetlendim ancak beceremediğim bazı durumlar oldu.

Farklı sayfalardaki checkboxların isimlerini bir listboxa yazdırmak istiyorum. "Seçilen Programlar" diye checkboxların isimleri gözükecek. Kurulum başlayınca da checkboxun adını bir labele yazdıracak.

Proje hazır; progress ve tek sayfada objelerin gösterilip gizlenmesi olayı tamam. Sadece dediğim gibi listboxa yazdırma işi kaldı.

[img]http://i52.tinypic.com/1ftrok.jpg[/img]

çalışmam tabiki bu değil, sadece ne anlatmak istediğimi tam olarak göstereyim diye bir örnek hazırladım.

Şimdiden herkese teşekkürler :)

NOT: Örnek çalışma ekte[/b]

Link to comment
Share on other sites

[b]Kodlar deneme projesinde sorun çıkarmıyor ama başka bir projeye aktardığımda aşağıdaki hatayı alıyorum.

[img]http://i52.tinypic.com/35ch5dv.jpg[/img]

Acaba Global Function dışında bir yere başka birşey yaptık da ben mi gözden kaçırdım?

Global Function kodları spoilerın içinde :)[/b]

[spoiler]

nSayi = 0;

function sec(sObject, sName)
bChecked = CheckBox.GetChecked(sObject)
if bChecked then
INIFile.SetValue("Autoplay\\Docs\\kurulum.ini", sName, "kur", "1")
nSayi = nSayi+1
Label.SetText("sayi", nSayi .. " adet program seçildi")
else
INIFile.DeleteSection("Autoplay\\Docs\\kurulum.ini", sName)
nSayi = nSayi-1
Label.SetText("sayi", nSayi .. " adet program seçildi")
end
end


function kontrol()
Label.SetText("sayi", nSayi .. " adet program seçildi")
tSections = INIFile.GetSectionNames("AutoPlay\\Docs\\kurulum.ini")

if tSections ~= nil then
for i=1,100 do
for y in pairs(tSections) do
if CheckBox.GetText("CheckBox" .. i) == tSections[y] then
CheckBox.SetChecked("CheckBox" .. i, true)
end
end
end
else
for i=1,100 do
CheckBox.SetChecked("CheckBox" .. i, false)
end
end
end

function kur()
tTablo = INIFile.GetSectionNames("AutoPlay\\Docs\\kurulum.ini")

if tTablo ~= nil then
Progress.SetRange("Progress1", 0, Table.Count(tTablo))
Progress.SetCurrentPos("Progress1", 0)
for i in pairs(tTablo) do
if INIFile.GetValue("AutoPlay\\Docs\\kurulum.ini", tTablo[i], "kur") == "1" then
nPos = Progress.GetCurrentPos("Progress1")
Progress.SetCurrentPos("Progress1", nPos+1)
nPos=nPos+1
Label.SetText("Label2", "" ..tTablo[i].. "")
File.Run("AutoPlay\\Docs\\Programlar\\" .. tTablo[i] .. ".exe", "", "AutoPlay\\Docs\\Programlar", SW_SHOWNORMAL, true)
end
end
File.Delete("AutoPlay\\Docs\\kurulum.ini", false, false, false, nil)
Progress.SetCurrentPos("Progress1", 0)
Label.SetText("sayi", 0 .. " adet program seçildi")
for i=1,100 do
CheckBox.SetChecked("CheckBox" .. i, false)
end
Progress.SetText("Progress1", "%0")
Dialog.Message("Tebrikler", "Seçmiş olduğunuz " .. nSayi .. " program başarıyla kuruldu. Ama işimiz daha bitmedi :)", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1)
if IDOK then
Page.Jump("son");
end
nSayi = 0;
else
Dialog.TimedMessage("Hata", "Hiç bir program seçilmedi!", 1000, MB_ICONEXCLAMATION)
end
end

function Isle()
if not tYuklenecekler then --eğer tYuklenecekler diye tablo yoksa;
tYuklenecekler = {}
end

for a, t in pairs(Page.EnumerateObjects())do -- t: Sayfada bulunan nesnelerin isimleri;
if (Page.GetObjectType(t) == 15) then --eğer t isimli nesne Checkbox ise;
if CheckBox.GetChecked(t) then --eğer t isimli checkbox nesnesi seçilmiş ise;
tYuklenecekler[#tYuklenecekler + 1] = CheckBox.GetText(t); --ismi tabloya aktar;
end
end
end
end

function Goster()
ListBox.DeleteItem("ListBox1", -1);
for a = 1, #tYuklenecekler do
ListBox.AddItem("ListBox1", tYuklenecekler[a], "");
end
end

[/spoiler]

[b]NOT: bu hata sadece listboxun kullanımında sorun çıkarıyor, kurulumda ve kurulum bittiğinde sayfa atlamasında biçhir sorun yok.[/b]

Link to comment
Share on other sites

Benim verdiğim örneğe baktıysan Goster fonksiyonunda aşağıdaki gibi ibare vardı, yukardaki hataya göre anlaman lazım orada tYuklenecekler nil (yani geçersiz diyor)

[code]function Goster()
if not tYuklenecekler then
tYuklenecekler = {}
end

ListBox.DeleteItem("ListBox1", -1);
for a = 1, #tYuklenecekler do
ListBox.AddItem("ListBox1", tYuklenecekler[a], "");
end
end[/code]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...