annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

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
Messaggio 1 di 11
7.829Visualizzazioni
Sorry, wrong post...
Message Edited by J-M on 03-31-2010 05:02 PM
0 Kudos
Messaggio 2 di 11
7.821Visualizzazioni

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
Messaggio 3 di 11
7.767Visualizzazioni

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
Messaggio 4 di 11
7.753Visualizzazioni

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
Messaggio 5 di 11
7.748Visualizzazioni

Hi,

 

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

 

See you soon!

 

 

0 Kudos
Messaggio 6 di 11
7.737Visualizzazioni

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
Messaggio 7 di 11
7.700Visualizzazioni

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
Messaggio 8 di 11
7.692Visualizzazioni
Its connect 4 but i just found out how you can check the diagonals and it works 😄
0 Kudos
Messaggio 9 di 11
7.689Visualizzazioni

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

0 Kudos
Messaggio 10 di 11
5.576Visualizzazioni