#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Posts
    1
    Rep Power
    0

    Check color in properties


    I have a Im not very good at programming and I want to ask if I can somehow check if the color of a statictext is for example red and if it does checkbox will be checked like :
    if statictext1.Color:=clred do
    chechbox1.Checked := True;

    It doesnt work for me like this tho.
    (Its saying that the expression must be boolean)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0
    Originally Posted by foothane
    I have a Im not very good at programming and I want to ask if I can somehow check if the color of a statictext is for example red and if it does checkbox will be checked like :
    if statictext1.Color:=clred do
    chechbox1.Checked := True;

    It doesnt work for me like this tho.
    (Its saying that the expression must be boolean)
    You're getting that error because you are using the symbol ":=" which means "is assigned the value" if you want to check the value of the property simply using the "=", not ":="

    Code:
    if statictext1.color = clred do //COMPARE statictest1.color with clred if the same execute the next statement
      checkbox1.Checked := True; //checkbox1.Checked is ASSIGNED the value True

IMN logo majestic logo threadwatch logo seochat tools logo