06-30-2011 06:22 PM
Hello
Hard luck for me today. I have been designing whole day a vi using event case to return the index of an element in the array. Good news. I finally got it!
Bad news! I found out that the array contains 150 elements and I need to use the scroll bar to access all elements. The vi I designed will look at the coordinates of mouse down and compare it with top/left position of the first element in array. calculates the distance of the mouse coordinates from the top of the array position on the pan. Unfortunately its no good for me now.
Any ideas how I could index into an array with a scroll bar?
Kind Regards
Austin
06-30-2011 09:28 PM
Can you post your VI so we can see what you've done?
Can't you just make the scrollbar for the array control visible?
Using mouse down and mouse coordinates sounds like it is more complicated than it needs to be.
07-01-2011 01:17 AM
Hi Austin,
Assuming that you have already made the algorithm for getting the indexes of the element which is being clicked based on the position of the first element, you can also do the same if a scroll bar is present. You can use the "Index Values" property of the the array to get the index of the first visible element in your array. That means if you scroll the elements , this property will give you the index of the first visible element of your array.
As i dont have enough time to make the whole code, i have attached a code containing just this part (usage of this property) assuming you can add this to your code and make it work as you need.
Regards,
Nitzz
(Give Kudos to good Answers and Mark it as a Solution if your problem is Solved;))
07-01-2011 03:44 AM - edited 07-01-2011 03:47 AM
As Ravens Fan says - make the scroll bar visible. I would then use this little gem from LAVA.
This gives you something pretty simple to implement which seems to cope with scroll bar position automatically, just scroll to position, click on an element and the index is provided... see the attached files.
Ian