PColik Posted January 13, 2018 Share Posted January 13, 2018 Arkadaşlar muhtemelen iyi bir başlık bulamadım ama sormak istediğim şu; Mesela ben Label.SetText(butunyazilar, "Merhaba"); dediğim zaman sayfada benim seçtiğim bütün Labellerin yazısı Merhaba olacak. Örneğin; butunyazilar = {"Label1","Label2","Label3"}; Label.SetText(butunyazilar, "Merhaba"); gibi... Verdiğim örnekteki kodun yanlış olduğunu biliyorum, onu salladım fakat demek istediğimi anladınız muhtemelen. Cevabınızı bekliyorum arkadaşlar... 1 Quote Link to comment Share on other sites More sharing options...
Cyph3r Posted January 13, 2018 Share Posted January 13, 2018 object_names = Page.EnumerateObjects(); if (object_names == nil) then Dialog.Message("Uyarı", "Yazı objesi yok.", MB_OK, MB_ICONEXCLAMATION); else output_string = ""; for index, object in pairs(object_names) do type = Page.GetObjectType(object); if (type == OBJECT_LABEL) then Label.SetText(object, "TNCTR"); end end end Yardım dosyasından giderek şunu uydurdum... Bir butona ekleyip test edin bakalım... 2 Quote Link to comment Share on other sites More sharing options...
PColik Posted January 14, 2018 Author Share Posted January 14, 2018 Cyph3r, 13.01.2018 - 20:41 yazdı: object_names = Page.EnumerateObjects(); if (object_names == nil) then Dialog.Message("Uyarı", "Yazı objesi yok.", MB_OK, MB_ICONEXCLAMATION); else output_string = ""; for index, object in pairs(object_names) do type = Page.GetObjectType(object); if (type == OBJECT_LABEL) then Label.SetText(object, "TNCTR"); end end end Yardım dosyasından giderek şunu uydurdum... Bir butona ekleyip test edin bakalım... Bu kod çalıştı. Sayfadaki bütün Label'ler üzerinde yaptı işlemi, ben buna istediklerimi ekleyebilir miyim. Mesela Label1, Label2 ve Label3 olsun. Veya Label1, Label2, Paraghraph1 gibi farklı öğeler olsun. O şekilde yapılabilir mi? Quote Link to comment Share on other sites More sharing options...
Cyph3r Posted January 14, 2018 Share Posted January 14, 2018 Yapılır... object_names = Page.EnumerateObjects(); Bu kod sayfadaki objeleri sayarak bir tabloya atıyor... aynı mantıkla kendi tablomuzu oluşturursak sadece oradakilerin yazısını değiştirir. Aşağıdaki kodu projenize göre düzenleyip yukarıdaki kod ile değiştirin... object_names = {"Label1","Label2", "Label4" }; 1 Quote Link to comment Share on other sites More sharing options...
PColik Posted January 15, 2018 Author Share Posted January 15, 2018 Cyph3r, 10 saat önce yazdı: Yapılır... object_names = Page.EnumerateObjects(); Bu kod sayfadaki objeleri sayarak bir tabloya atıyor... aynı mantıkla kendi tablomuzu oluşturursak sadece oradakilerin yazısını değiştirir. Aşağıdaki kodu projenize göre düzenleyip yukarıdaki kod ile değiştirin... object_names = {"Label1","Label2", "Label4" }; Kardeşim aslında bu kodda çalıştı ama sanırım ben biraz acemi olduğum için yine yapmak istediğimi yapamadım Ben direkt yapmaya çalıştığım şeyi söyleyeyim de seni daha fazla uğraştırmim Şimdi Global Functions'a şunu ekledim: objects = Page.EnumerateObjects(); objects = {"Label1","Label2","Paragraph1"}; Sayfa içine de bir buton ekledim. O butona bastığım zaman Global'de ki object içindeki öğelerin rengini kırmızı yapacak. SetText gibi basit şeyleri yapabildim ama SetProperties biraz daha farklı galiba, onu yapamadım Quote Link to comment Share on other sites More sharing options...
Cyph3r Posted January 15, 2018 Share Posted January 15, 2018 Giriş seviyesinden terk AMS ciyim fazla bilmiyorum ama globale eklediğin kod hatalı olur şu durumda... Kendi obje tablomuzu oluşturduğumuz zaman ....EnumerateObjects kodunu kullanmamıza gerek yok daha... o kısmı siliyoruz... renkle ilgili yaptığım deneme de böyle... object_names = {"Label1","Label2", "Label4" }; if (object_names == nil) then Dialog.Message("Uyarı", "Yazı objesi yok.", MB_OK, MB_ICONEXCLAMATION); else output_string = ""; for index, object in pairs(object_names) do type = Page.GetObjectType(object); if (type == OBJECT_LABEL) then tRenk = Label.GetProperties(object); tRenk.ColorNormal = Math.RGBToNumber(255, 0, 0); Label.SetProperties(object, tRenk); end end end Globalde değil... direkt Page içinde bir butona koyup çalıştırdım... 1 Quote Link to comment Share on other sites More sharing options...
PColik Posted January 16, 2018 Author Share Posted January 16, 2018 Cyph3r, 19 saat önce yazdı: Giriş seviyesinden terk AMS ciyim fazla bilmiyorum ama globale eklediğin kod hatalı olur şu durumda... Kendi obje tablomuzu oluşturduğumuz zaman ....EnumerateObjects kodunu kullanmamıza gerek yok daha... o kısmı siliyoruz... renkle ilgili yaptığım deneme de böyle... object_names = {"Label1","Label2", "Label4" }; if (object_names == nil) then Dialog.Message("Uyarı", "Yazı objesi yok.", MB_OK, MB_ICONEXCLAMATION); else output_string = ""; for index, object in pairs(object_names) do type = Page.GetObjectType(object); if (type == OBJECT_LABEL) then tRenk = Label.GetProperties(object); tRenk.ColorNormal = Math.RGBToNumber(255, 0, 0); Label.SetProperties(object, tRenk); end end end Globalde değil... direkt Page içinde bir butona koyup çalıştırdım... Bu sefer tamamdır, adamsın Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted January 16, 2018 Editor Share Posted January 16, 2018 İçine paragraph objesi eklersen kod çalışmaz. if (type == OBJECT_LABEL) then Çünk burada sadece Label olanlara bu işlemi yapıyor 1 Quote Link to comment Share on other sites More sharing options...
PColik Posted January 18, 2018 Author Share Posted January 18, 2018 pairs, 16.01.2018 - 16:44 yazdı: İçine paragraph objesi eklersen kod çalışmaz. if (type == OBJECT_LABEL) then Çünk burada sadece Label olanlara bu işlemi yapıyor Paragraph için; if (type == OBJECT_PARAGRAPH) then yaptım. Bu doğru değil mi? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted January 31, 2018 Editor Share Posted January 31, 2018 Evet dogrudur. Nesneleri getirdikten sonra her nesnenin tipine bakıp ona göre settext yaparsın. Label.SetText paragraph ta çalışmaz örneğin. O yüzden bu yöntemi kullanmn gerekecek. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.