Jump to content

Değerlere Göre Input'un Rengini Değiştirme


PColik
 Share

Recommended Posts

Merhaba arkadaşlar. Sizlerden isteğim tam olarak şu:

Input1'e sadece 0 ile 100 arası sayı girilebiliyor. Bunun için bana yardımcı olan Ex_treme isimli kullanıcıya teşekkürler.

Benim isteğim ise Input1'de ki sayı 0 ila 50 arasında ise Input1 arkaplan rengi kırmızı (#ed1c24), 50 ile 100 arasında ise Input1 arkaplan rengi yeşil (#00a651) olacak. Yardımlarınızı bekliyorum.

 

Teşekkürler...

Link to comment
Share on other sites

Kardeş vakit ayırdığın için çok teşekkürler ama bu kod ile değer kaç olursa olsun renk yeşil oluyor.


Fakat ben başardım sanırım. Belki başkalarınada yardımcı olur. Kod şöyle:
 

giris = Input.GetText("Input1");
if giris == "50" then
Input.SetProperties("Input1", {BackgroundColor = Math.HexColorToNumber("00a651")});
end
if String.ToNumber(giris) > 50 then Input.SetProperties("Input1", {BackgroundColor = Math.HexColorToNumber("00a651")}); end
if giris ~= "50" and giris ~= "" then
if String.ToNumber(giris) < 50 then Input.SetProperties("Input1", {BackgroundColor = Math.HexColorToNumber("ed1c24")}); end
result = Input.GetText("Input1");
end
 
Bu koda göre Input1'de ki sayı 0 ile 50 arasındaysa kırmızı, 50 ve üzerindeyse yeşil yanar.
Edited by PColik
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...