spaghetti_developer Posted May 20, 2010 Report Share Posted May 20, 2010 Hi to All, I want to redirect a TAB pressure on a control that is contained into a cluster that is an element of an array. When the user press the TAB control I want the focus on the following array elemet. How can I do that? I tryed to catch the key-down? event and the key-down event on the array element but it doesn't work as aspected. Obviously I can't catch the cluster event becouse it's containing into the array. Is there another way to do what I want to do? Quote Link to comment
hooovahh Posted May 20, 2010 Report Share Posted May 20, 2010 This is not the right way to do this by any means, but here is what I have done in the past. Instead of displaying an array and showing the 6 elements at a time, with a vertical scroll bar to scroll down the array elements, I would create 6 string controls. Then when the operator pressed enter it would toggle a boolean, this event would look at which of the 5 string controls had focus and then bring focus to the next one. If the last string control had focus it would move the vertical scroll bar down. And when the vertical scroll bar changed value it would take the 5 input strings, and put them in an array at the index that the scroll bar was at. This would give an illusion that the operator is seeing an array when really it is just several strings whos keyfocus could be controlled independently. Attached is an example VI of how this all works. Sorry there isn't much comments or documentation but I think it is easy enough to follow most of the time. Just add new questions in the Get Questions case (there are 11 right now) and remember that Enter moves you to the next item. You could probably use Tab if you created an event for the keydown and used that instead of the boolean off screen. There is some issues with giving keyfocus at the beginning so you may have to click in the first element. Also you are required to enter an answer for each of the questions and you may loose keyfocus when the one button dialog box appears telling you to enter data for each element. Once you enter data for each item the output array (to the right) has the answers. Array Focus (8.6).vi I'm hoping there is an easier way of doing this, but I couldn't find a way to get or set the keyfocus of an index in an array. Quote Link to comment
spaghetti_developer Posted May 21, 2010 Author Report Share Posted May 21, 2010 Thank you for your support hooovahh, This is not the right way to do this by any means, but here is what I have done in the past. Yes, this isn't the right way for resolve my problem but you gave me an idea to get my goal. I'm working with clusters and the code that you suggest me don't work good with them. So, to reach my goal I built a xControl with a special fuunction that controls the target of the focus. I get the reference of the control that have the focus searching inside the controls[] array property of the selected cluster and when the user press the [TAB] button I redirect the focus to the same control in the next cluster. The face of the xControl like an array but it isn't an array, inside the array I can't control the focus of the fields of the cluster. I copied your function to control the movement effect with the scollbar and it work very good. This is all. Thank you very much for your support..... Have a nice day. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.