03-31-2010 03:42 PM
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
03-31-2010 04:00 PM - edited 03-31-2010 04:02 PM
04-02-2010 06:41 AM
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..
04-02-2010 11:22 AM
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.
04-02-2010 11:42 AM - edited 04-02-2010 11:44 AM
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).
04-02-2010 12:24 PM
Hi,
thanks for the help , I'll try the new information a.s.a.p.!
See you soon!
04-04-2010 06:11 AM - edited 04-04-2010 06:15 AM
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
04-04-2010 07:07 AM
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 🙂 🙂
04-04-2010 07:19 AM
08-29-2018 02:40 AM
What is the use of mouse down event in the vi that you had specified?