LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Event Structures with Array of Clusters

Using LabVIEW 8.5

Hi all,

I'm trying to convert an existing application to one that can be used through a touch screen. I updated the UI and added an event structure to listen for mouse ups on controls that require a HMI keyboard or numpad to show up. Although I've been programming for a while, I'm new to LabVIEW and am struggling with a problem:

Is there any way to have an event case listen to an event within arrays?
I've seen a few examples on the forums, but they all start with breaking up the arrays into individual variables. Using the variables, they build arrays. This seems pretty tedious, and I'm pretty sure I can't apply it to one of my arrays. Essentially, I just want to know which cluster in which array the user has clicked on, so I can open the HMI keyboard or numpad and send the text to that cluster. In my watered down app (Array of Clusters.vi), I've put 3 arrays of clusters and a few stand-alone controls to give you guys an idea of what I'm taking about.

BTW, I'm using the HMI Keyboard and Numpad built by the Beta Community (http://decibel.ni.com/content/docs/DOC-1062) and modified it to add a "Clear" button to the keyboard and numpad. Please let me know if I implemented this in the best way.

Thanks for the help,
Kunal


Message Edited by bhatiak on 08-04-2008 03:55 PM
Message 1 of 10
(4,278 Views)
I don't know a direct way to get the array element, however I know these things where solved in the past by some additional calculating:
get the screen position and shown index of the array control (it's all in the fineprint properties ) and your mouse/finger position (left box of mouse event) and you can calculate the array element

another screen keyboard is might be provided by your OS ...

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 2 of 10
(4,240 Views)

My old tic tac toe example shows how to determine which square of a 2D array has been clicked.

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=247044#M247044

You probably can adapt some of it for the arrays on the right. If the array can be scrolled, you also need to account for the "indexvals" offset.

The Layers controls is easiest, because you only show one element. Just read the "index vals" property to get the array element and parse the coordinates to get the cluster element.

btw: the small while loop on the right serves no purpose at all and acts just as a CPU burner. You can delete it without any change in functionality. Is there anything else to it?

Message 3 of 10
(4,233 Views)
You can set up a Value Change event on the entire array and then use the NewVal and OldVal nodes in the event structure to determine which element exactly has changed. In this situation, the OldVal node will contain the contents of the array before the event and the NewVal node will contain the contents of the array after the event.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 10
(4,232 Views)


mikeporter wrote:
You can set up a Value Change event on the entire array and then use the NewVal and OldVal nodes in the event structure to determine which element exactly has changed. In this situation, the OldVal node will contain the contents of the array before the event and the NewVal node will contain the contents of the array after the event.

I think in this case this will not work, because the value only changes after the data has been entered on the popup keypad/board.
 
Maybe there is an easy way to find the control that has focus? I have no experience with touch panels, but this seems like a very common task.
 
Message 5 of 10
(4,209 Views)
Looks like the hit test Henrik and Alten mentioned will be the best method to solve this problem. Thanks for the ideas, and I'll let you know if I run into any roadblocks.

0 Kudos
Message 6 of 10
(4,155 Views)

Hi again everyone,

 

When I was almost done implementing my numpad popup, I ran into one more issue. I'm able to bring up numpads for numfields in arrays, but not for the index display of the array. Any ideas how to solve this? I've attached a VI named "Layer Setup," which shows how I bring up a numpad for a numfield inside an array. It brings up the numfield from the correct index as well.

 

Thanks,

Kunal

Message Edited by bhatiak on 08-19-2008 02:48 AM
0 Kudos
Message 7 of 10
(4,083 Views)

Any thoughts on the hit test or getting an event listener on the index (or "dimension") value of an array?

 

Kunal

0 Kudos
Message 8 of 10
(4,011 Views)

Hi bhatiak,

 

Using mostly your code, here is an example showing how to get your popup for an array index.  (The example is written in LabVIEW 8.5.1 since your popup subVI didn't like me trying to save it in version 8.0.)

 

Regards,

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 9 of 10
(3,976 Views)

Ahh - I see what I missed. Didn't quite know what to do with the array to get the index value. Thanks for the help Kevin!

 

Kunal

0 Kudos
Message 10 of 10
(3,948 Views)