01-08-2009 01:17 PM
Hello,
i would like to know if there is a way to know wich cell is concerned by cursor when i click on one element
ie: is there a possibility to work on array of cluster as if we were working on listbox to have in return (0,0) or (5,3) or (2nd row, command XXX)
here a starting vi
Best regards
Tinnitus
Solved! Go to Solution.
01-08-2009 01:52 PM
For an array you should try this piece of code.
For a cluster element you can get it's bounds, and you can get the mouse position. With a pane method (to global coordinates) you can convert between both and test position.
Ton
01-08-2009 02:45 PM
How about an event structure, using a mouse click as an event.
Then use a property node to find the value of the selected cell.
(Attached simple example)
01-08-2009 05:03 PM - edited 01-08-2009 05:05 PM
The code by Cory will give you the value of the clicked cell, without telling you the index position(s). From the original question, it seems we want the array indices.
By the way, you can create a reference to the array element, eliminating the need for variant gymnastics, (see image. top: my version, bottom: Cory version.)
Cory also uses the wrong representation, which should be DBL.
If you need the indices of the clicked element, you could also do something along the lines I used in the tic-tac-toe player posted long ago here. Have a look!
01-09-2009 11:26 AM - edited 01-09-2009 11:29 AM
altenbach wrote:Cory also uses the wrong representation, which should be DBL.
I have a nasty habit of wiring I32 just by default because it is the first thing I see in the numerical palette.
But you are correct, if should be of type DBL (along with the numerous other corrections)
And apparently I have a history of LabVIEW gymnastics .
01-13-2009 10:41 AM
Hello,
Sorry for delay i was sick,
Thanks for help but i don't understand everything.
Having the values could be interesting but in firtst time i need to know wich row ( of my 1D array) is concerned
later i may need to have wich "element of cluster" of this row is concerned, that 's what i called indices: (row, element of cluster)
but in first time only recovering row index could help me
i tried to write a vi with "i" ,a masked element in cluster that i fill each time change is detected, but it's done every time , even is size
has not changed. i don't think it is a good method, i don't see how to improve it.
@altenbach, your TTT seems nice but i don't kow where to look to find what you said could you lightnened me...
Best regards
Tinnitus
01-13-2009 11:07 AM
a little error in my duplets, it's (0,0)(1,1)(4,2) and not (0,0)(1,2)(4,2)
Best regards
Tinnitus
01-14-2009 04:08 PM
hello,
Anyone for a small lighting ?
best regards
Tinnitus
01-14-2009 07:54 PM
tinnitus wrote:hello,
Anyone for a small lighting ?
Exactly what does that sentence mean?
I only have a vague idea of what you are trying to do here. But I think you have a race condition going on. Why in each iteration of the loop to you write the value of the 1-D array control back onto itself?
When you click on something like the boolean or the increment/decrement values of the numerics, the mouse down event fires even before the the actual value has changed. So the old data of the array gets fired off, and then gets rewritten back over itself even if you've changed the value in the array. Try running the VI in highlight execution to slow it down and see what is happening.
01-15-2009 05:52 AM
Hello Ravens,
thank you for reading,
i have a 1d array of clust (numeric, enum, light btn)
i only want to know wich row is concerned when an operator click on a line of this array
size of array can be changed by user, for example when he click on cell that is not still active
Best regards
Tinnitus