Prev: get number of iterations of case structure
Next: modbus
From: bhatiak on 4 Aug 2008 17:10 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 (<a href="http://decibel.ni.com/content/docs/DOC-1062" target="_blank">http://decibel.ni.com/content/docs/DOC-1062</a>) 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, KunalMessage Edited by bhatiak on 08-04-2008 03:55 PM Array of Clusters4.llb: http://forums.ni.com/attachments/ni/170/346472/1/Array of Clusters4.llb
From: Henrik Volkers on 5 Aug 2008 03:40 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 elementanother screen keyboard is might be provided by your OS ...
From: altenbach on 5 Aug 2008 04:10 My old tic tac toe example shows how to determine which square of a 2D array has been clicked. <a href="http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=247044#M247044" target="_blank">http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=247044#M247044</a> 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?
From: mikeporter on 5 Aug 2008 04:10 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...
From: altenbach on 5 Aug 2008 12:10
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. |