LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display the currently active cell coordinates.

I have a 2D array numeric control that I use as a source for a message being sent to a device.
I would like to display to the user which cell they are editing. For example: I click on row1, col3 and use the keyboard arrows keys to increase or decrease the value then press TAB to move on to the next cell.
Since there are over 100 cells it's difficult to keep track of where I am so it would be very usefull to know the coordinates of the cell that is currently selected.
The idea would be simular to indicating what the row and column your at in a word processor.

Thanks guys. :}
0 Kudos
Message 1 of 9
(4,433 Views)
Hi,
I don't know if it's possible to do this with a 2D array.
You can use a table : there is an attribute node which send you the selected cell.
Alexis de La Fontaine.
0 Kudos
Message 2 of 9
(4,433 Views)
At first I though you could just use the selection start property of the array...but that does not seem to work the same way as with e.g. a table (which would be one solution...).

A solution when using a 2D array though is to calculate the row and column of the active cell by reading out the element position property and find the index using the position of cell 0,0, the bounds of the array elements and the index value...see attached example.

Mads
Message 3 of 9
(4,433 Views)
I could not look at your example because I have rev 6.0.2 and not 6.1 :{ I've found that taking a screen shot for people to look at is more universal. :}

But! I figured out what your were explaining and it just may work. I think a "Zero Position" button may be needed to set r0,c0 to 0,0 using an offset value then I could reference from there.

Thanks! Not a bad work around. :}
0 Kudos
Message 4 of 9
(4,433 Views)
See attached picture...I read out the initial position once when cell 0,0 was selected and I think you could use that as a constant as long as you don't allow the users to modify the design of the array...(i.e. it's a built application) no "position calibration" button necessary.
0 Kudos
Message 5 of 9
(4,433 Views)
I came up with a simular solution. The only qwerk was that my column width is not static. I added some fluff to show the radix. Anyway, your solution works great. I did a bit more math and offset to make selection of 0,0 give an indication of 1 instead of zero. And yeah, you should only have to zero out the scheme once. Also, since the array is reshaped into a 1D array and put out the serial port my scheme shows (row*10)+col. I attached some pics. Thanks again! :}
0 Kudos
Message 6 of 9
(4,433 Views)
I looked into that. Tables are text so even though I am editing a hex message the table does not bound you to 0-FF. Could be done with some addition bounding work though. Thanks for the reply. :}
0 Kudos
Message 7 of 9
(4,433 Views)
I have a more complete solution based on the same technique as Mads. I have made it a subVI that takes into account N dimensional arrays and element gap if any. See attachment for the subVI and an example how to use it. I wish there were a property node for that.


LabVIEW, C'est LabVIEW

0 Kudos
Message 8 of 9
(4,433 Views)
Thanks Jean-Pierre,

This really doesn't solve my problem. Maybe I should explain again.

If the front-panel has an array of strings, clicking on one element allows you to enter text. For this to work, the individual item has to have key focus. I want to be able to control key focus programatically (not highlighting as my question actually suggests - sorry for that). I want to do things in the reverse fashion to what you have done in your example. I want to give key focus to a different cell clicking.

I found your example quite interesting, but I thought of a different (and for my liking much simpler) way. I know that the array element reference allows the code to give key focus to the last clicked item, which I have used here.
You can also use the "array element" item to get the X and Y coordinates and size of the item, facilitating your calculations similarly to before.

I have given up on the idea at this stage. It works with Tables, and something that works doesn't need repairing.

Cheers

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 9 of 9
(4,433 Views)