Jump to content

Checkbox Anlatımı 4


MostWanted
 Share

Recommended Posts

CheckBox Anlatımı 4

CheckBox Anlatımı 3 dersinin devamı niteliğindedir.Yeni video yoktur.

Açıklama;

Uzun zamandır forumu takip ediyorum ve buna bağlı olarak yeni bir ders değil de önceki dersin devamı niteliğinde fakat onu düzeltecek daha güzelleştirecek bi ders yapmayı uygun gördüm.Bunun için tekrar tekrar video çekmedim.Şimdi bütün olayı teker teker aşağıda anlatıyorum..

KODLAR

Global Functions

--[[Bu fonksiyonlar MostWanted (talha_252) tarafından yazılmıştır..
Lütfen editlemeyiniz..]]--
--================================================================
--================================================================
parca=0
tamami=0
function sifirla()
parca=0
tamami=0
end
function secme(yazim) 
sonuc = CheckBox.GetChecked(yazim)
if not (sonuc) then
talha = {};
talha.FontBold = false
talha.FontWeight = 100
CheckBox.SetProperties(yazim, talha);
else
talha = {};
talha.FontBold = true
talha.FontWeight = 700
CheckBox.SetProperties(yazim, talha);
end
end
function okuyucu(yazim)
sonuc = CheckBox.GetChecked(yazim)
if (sonuc) then
tamami=tamami+1
end
end
function yaz()
parca=parca+1
end
function progress()
return Math.Ceil((parca/tamami)*100)
end
function kurulum(checkboxadi, progadi, progexe)
secilim = CheckBox.GetChecked(checkboxadi);
if (secilim) then
StatusDlg.SetMessage(progadi.." sisteminize kurulurken lütfen bekleyin.");
result = File.Run("AutoPlay\\Docs\\"..progexe, "", "", SW_SHOWNORMAL, true);
    error = Application.GetLastError();
    if (error ~= 0) then
        Dialog.Message("Error - "..progexe, _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end

yaz()

StatusDlg.SetTitle("%"..progress().." kurulum tamamlandı..");
end
end
function hepsinioku(oku)
    for i=1, oku do
      okuyucu("CheckBox"..i)
    end
end
--================================================================
--================================================================

On Timer

StatusDlg.SetMeterPos(progress());

Kur butonu Kodları

sifirla()
--Artık tek tek yazmak yok.Eğer Checkboxlarınız CheckBox1, CheckBox2 .. şeklindeyse bunu kullanabilirsiniz..
hepsinioku("4")
Page.StartTimer(100)
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.SetTitle("%0 kurulum tamamlandı..");
Window.Hide(Application.GetWndHandle()); -- pencereyi gizler
kurulum("CheckBox1", "Winrar", "winrar.exe")
kurulum("CheckBox2", "Winamp", "winamp.exe")
kurulum("CheckBox3", "Ccleaner", "ccleaner.exe")
kurulum("CheckBox4", "AMS", "ams.exe")
StatusDlg.SetMessage("Kurulum Sonlandırılıyor..");
Application.Sleep(1000)
StatusDlg.Hide();
Window.Show(Application.GetWndHandle()); -- pencereyi gösterir

Burdaki en önemli özellik "kurulum" komutudur.Bu komut sizin daha önce manuel olarak yaptıklarınız tek satırda yapacak.Tek yapmanız gereken; "kurulum("CheckBox'un ismi", "Programın Exesi", "Programın exesinin adı") " Burda dikkat edilmesi gereken yapılmış olan katılımsız kurulumların exesi Docs klasöründe olmalı ve exe'nin isminin doğru yazılmasıdır.Böylece işler çok kolaylaşmış olacak.

Örnek Dosya:

http://rapidshare.com/files/379724860/chcekbox.anlatimi.4.apz

NOT: Bu dersin iyi anlaşılabilmesi için Checkbox Anlatımı 3 dersinin izlenilmiş olması gerekmektedir.

Sorularınız için burdayım..

Edited by talha_252
Link to comment
Share on other sites

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Kesinlikle bir değişim gerekiyordu.Kodlar uzadıkça uzuyordu acemiler karıştırdıkça karıştırıyordu.Bende böyle bi kod yapayım dedim.Asıl beni şaşırtan bunu daha önce nasıl düşünemediğim..

Link to comment
Share on other sites

  • 2 hafta sonra ...
  • 1 ay sonra...

Globel kısmında Function kurulum(vs vs vs) adında bi başlık vardır.Ona gel Ordaki result = File.Run("AutoPlay\\Docs\\neklasörüistiyosan\\"..progexe, "", "", SW_SHOWNORMAL, true);

yaparsan artık Doc klasörü içinde hangi klasöre atarsan orda çalışır.Ama diyosan ki a.exe'si şurda olsun b.exe si şu klasörde olsun o zaman kur butonuna yazdığın kurulum komutunu şöyle yapacaksın;

kurulum("CheckBox1", "Winrar", "aklasörüexesi\\deneme.exe")

böyle yaparsan Docs klasörü altındaki aklasörüexesi içindeki deneme.exe yi çalıştırır ;) Kısaca anlayacağın komple değiştirmek istiyosan Global'i ama diyosan ki şu exe şurda olacak bu exe burda o zaman ikinci yolu..

Link to comment
Share on other sites

benim yapmak istediğim 2 kısımdaki gibidir. Bir sorum daha olacak. 2 sayfada checkbox olsun kur butonuna basınca diger sayfadaki checkbox bilgisinide alsın. Bunu nasıl yapabiliriz?

Not: Forumda diger sayfadan checkbox verilerini çekme anlatılmış. Ama ordaki kodlar checkbox 3 göre anlatılmış, yazılan checkbox 4 farklı olduğu için birşey yapamadım.

Link to comment
Share on other sites

daha önceden bir arkadaş için bir örnek hazırlamıştım. belki buna entegre edersiniz.

Global Functions:

nCheck1 = 0;
nCheck2 = 0;

Page1 On Preload:

if nCheck1 == 1 then
CheckBox.SetChecked("CheckBox1", true)
nCheck1 = 1; 
else
CheckBox.SetChecked("CheckBox1", false)
nCheck1 = 0;
end

Page2 Preload:

if nCheck2 == 1 then
CheckBox.SetChecked("CheckBox2", true)
nCheck2 = 1; 
else
CheckBox.SetChecked("CheckBox2", false)
nCheck2 = 0;
end

CheckBox1 On Click:

sKontrol = CheckBox.GetChecked(this)
if sKontrol then
nCheck1 = 1;
else
nCheck1 = 0;
end

CheckBox2 On Click:

sKontrol = CheckBox.GetChecked(this)
if sKontrol then
nCheck2 = 1;
else
nCheck2 = 0;
end

Kur On Click:

if nCheck1 == 1 then
Dialog.Message("Mesaj", "1. Program seçildi ve kuruldu")
end

if nCheck2 == 1 then
Dialog.Message("Mesaj", "2. Program seçildi ve kuruldu")
end

Edited by KintaRo
Link to comment
Share on other sites

Kintaro onu arkadaşta demiş zaten o örneği gördüm (bende benzer bi örnek yaptım) Ama tam entegre istiyor yani bnm kodlarıma..Kodlarımı baştan yazmam gerekiyodu ben de zahmetli dedim.Ama tabiki dediğin yolu kullanabilir..

Link to comment
Share on other sites

şu şekilde olabilir. 10 tane checkboxın oldugunu varsayıyorum:

Global Functions kodu:

nCheck = 0;

Page On Show kodu:

Page.StartTimer(100)

Page On Timer kodu:

if nCheck == 10 then
CheckBox.SetChecked("tumunusec_checkboxi", true)
else
CheckBox.SetChecked("tumunusec_checkboxi", false)
end

ve her Checkboxin On Click kodu:

sGet = CheckBox.GetChecked(this)
if sGet then
nCheck = nCheck+1
else
nCheck = nCheck-1
end

Link to comment
Share on other sites

şu şekilde olabilir. 10 tane checkboxın oldugunu varsayıyorum:

Global Functions kodu:

nCheck = 0;

Page On Show kodu:

Page.StartTimer(100)

Page On Timer kodu:

if nCheck == 10 then
CheckBox.SetChecked("tumunusec_checkboxi", true)
else
CheckBox.SetChecked("tumunusec_checkboxi", false)
end

ve her Checkboxin On Click kodu:

sGet = CheckBox.GetChecked(this)
if sGet then
nCheck = nCheck+1
else
nCheck = nCheck-1
end

hocam denedim ama saçmalıyor bazen işaretliyor bazen işaretlemiyor

Link to comment
Share on other sites

haklısın kodlar hatalı doğrusu şu şekilde olacak:

Page on show kodu:

Page.StartTimer(100)

Page On Timer kodu:

sGet1 = CheckBox.GetChecked("CheckBox1")
sGet2 = CheckBox.GetChecked("CheckBox2")
sGet3 = CheckBox.GetChecked("CheckBox3")
sGet4 = CheckBox.GetChecked("CheckBox4")
sGet5 = CheckBox.GetChecked("CheckBox5")
sGet6 = CheckBox.GetChecked("CheckBox6")
sGet7 = CheckBox.GetChecked("CheckBox7")
sGet8 = CheckBox.GetChecked("CheckBox8")
sGet9 = CheckBox.GetChecked("CheckBox9")
sGet10 = CheckBox.GetChecked("CheckBox10")

if sGet1 and sGet2 and sGet3 and sGet4 and sGet5 and sGet6 and sGet7 and sGet8 and sGet9 and sGet10 then
CheckBox.SetChecked("tumunusec", true) else
CheckBox.SetChecked("tumunusec", false)
end

sadece bunlarla işini görebilirsin.

istersen tümünü seç checkboxı içinde şu kodları kullanabilirsin:

sGet = CheckBox.GetChecked(this)
if sGet then
ilk=1
son=10
adim=1
	for adim=ilk,son do
	CheckBox.SetChecked("CheckBox"..adim, true)
	end

else

ilk=1
son=10
adim=1
	for adim=ilk,son do
	CheckBox.SetChecked("CheckBox"..adim, false)
	end
end

Not: son=10 sayısını checkbox sayına gore duzeltirsin.

Edited by KintaRo
Link to comment
Share on other sites

Kintaro bi gün giremedim hemen cvpları sen devralmışsın :) Bu arada cvpa bi alternatif sunmak istiyorum..

sGet = CheckBox.GetChecked(this)
if sGet then
nCheck = nCheck+1
else
nCheck = nCheck-1
end
if nCheck == 10 then
CheckBox.SetChecked("tumunusec_checkboxi", true)
else
CheckBox.SetChecked("tumunusec_checkboxi", false)
end

On timer'e gerek yok.Zaten sadece checkboxlara tıklanıldığında işlem olacağı için..bu arada globale nChwck=0; yazmayı unutmuyosun tabi :)

Link to comment
Share on other sites

  • 2 hafta sonra ...

if String.ToNumber(Label.GetText("Talhas")) == 0 then
Dialog.Message("Hata!", "Lütfen bir program seçiniz!")
else
--geri kalan kodlar
end

Bu kodu hepsinioku komutundan sonra kullanırsanız eğer kullanıcı program seçmediyse hata vererek program seçmesini ister!

Link to comment
Share on other sites

  • 4 hafta sonra ...

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...