make boolean Array 8x4 been seen with rectangles for itch index

I have array :

Inputs[1..8],[1..4] of Boolean


and 32 rectangles (Shape) in my Forme1. For Itch rectangle correspond one index array( Inputs).

For Itch index of array i would like to make change color of rectangle in dependence of state of index (true or false).

Hove can it be done?

Thank you

Comments

  • : I have array :
    :
    : Inputs[1..8],[1..4] of Boolean
    :
    :
    : and 32 rectangles (Shape) in my Forme1. For Itch rectangle
    : correspond one index array( Inputs).
    :
    : For Itch index of array i would like to make change color of
    : rectangle in dependence of state of index (true or false).
    :
    : Hove can it be done?
    :
    : Thank you
    :
    I would suggest that you place your shapes into another 2D array. This way you can quickly have access to the shape based on the indexes:
    [code]
    var
    Rectangles: array[1..8, 1..4] of TShape;
    [/code]
    Now you can use a nested for-loop to change the color:
    [code]
    for x := 1 to 8 do
    for y := 1 to 4 do
    if Inputs[x, y] then
    Rectangles[x, y].setColor(Color1)
    else
    Rectangles[x, y].setColor(Color2);
    [/code]
  • : : I have array :
    : :
    : : Inputs[1..8],[1..4] of Boolean
    : :
    : :
    : : and 32 rectangles (Shape) in my Forme1. For Itch rectangle
    : : correspond one index array( Inputs).
    : :
    : : For Itch index of array i would like to make change color of
    : : rectangle in dependence of state of index (true or false).
    : :
    : : Hove can it be done?
    : :
    : : Thank you
    : :
    : I would suggest that you place your shapes into another 2D array.
    : This way you can quickly have access to the shape based on the
    : indexes:
    : [code]:
    : var
    : Rectangles: array[1..8, 1..4] of TShape;
    : [/code]:
    : Now you can use a nested for-loop to change the color:
    : [code]:
    : for x := 1 to 8 do
    : for y := 1 to 4 do
    : if Inputs[x, y] then
    : Rectangles[x, y].setColor(Color1)
    : else
    : Rectangles[x, y].setColor(Color2);
    : [/code]:



    Thank you
    it's satisfaction to get clear answer, and i relay hope I'll get more assistance with this my attempt of introduction of human machine interface into machine maintenances.

    1. I haven't' got sauces not even to drove my arrays in new form
    (Rectangles: array[1..8, 1..4] of TShape;)

    2. but to include it in existent project with two forms (first for processing inputs and second for visualization)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories