LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Color box in a 2D Array

Hi,

 

I am a beginner in Labview , i want to color a box in a 2D Array of color boxes.  So if the user clicks on a box inside the 2D array, the box will turn into a specific color. I think i need to get the column and  row of the element that has been clicked.

 

Then i want to check if the box already has been turned into another color , if not i want to turn it into a specific color ( e.g. connect 4).If it already has been turned into a specific color it wont change.

 

[img]http://i42.tinypic.com/dm9v9h.jpg[/img]

 

thats the color box.

 

So can someone please help me with this problem.

 

Thx

0 Kudos
Message 1 of 11
(7,005 Views)
Sorry, wrong post...
Message Edited by J-M on 03-31-2010 05:02 PM
0 Kudos
Message 2 of 11
(6,997 Views)

Actually disabling one element of an array is not possible, because each element of an array has the same properties. You can only disable the whole array.

What you can do is create a cluster filled with colorboxes en disable those color boxes then seperately..

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 3 of 11
(6,943 Views)

You can just use an event structure to capture a user event (mouse-down).

Then use a property node to check the color. If the color is white, change the color.

If not, leave it alone. I will try to come up with a quick example.

Cory K
0 Kudos
Message 4 of 11
(6,929 Views)

Here is a quick example (not at all bullet-proof, just trying to give you an idea).

All of the squares start white.

If a white square is clicked, it will turn red.

If it is already red, it will stay red.

Hope that helps getting you started.

 

Edit: I forgot one quick thing. Wire a constant of 100 to the event timeout (the hourglass in the upper left corner).

Message Edited by Cory K on 04-02-2010 11:44 AM
Cory K
0 Kudos
Message 5 of 11
(6,924 Views)

Hi,

 

thanks for the help , I'll try the new information a.s.a.p.!

 

See you soon!

 

 

0 Kudos
Message 6 of 11
(6,913 Views)

Hi ,

 

I managed to check the colomns and rows to see if is has 4 of the same colorboxes , but now i want to check the diagonals .

 

But i cant see how that is possible , someone has got a tip?

 

Im trying to append a element of the Arry ( bord)  , so i have the 4 color boxes diagonal. But when i look into appended array , i have only 1 element after executing the file.

 

 http://i40.tinypic.com/2yx3lh1.png

 

 

Thx

 

Message Edited by StillTrying on 04-04-2010 06:15 AM
0 Kudos
Message 7 of 11
(6,876 Views)

Is this a TicTacToe game with colours instead of X and O?

Lot's a examples on this forum for X and O 🙂

 

If it isn't, search anyway since the principles are the same 🙂 🙂

0 Kudos
Message 8 of 11
(6,868 Views)
Its connect 4 but i just found out how you can check the diagonals and it works 😄
0 Kudos
Message 9 of 11
(6,865 Views)

What is the use of mouse down event in the vi that you had specified? 

0 Kudos
Message 10 of 11
(4,752 Views)