01-31-2011 10:00 AM
I want to use an event structure to increase/ decrease a value.
It works with 1 Step.
But i want to increase the value continuously (200ms steps) while i press the button with the mouse. So the user could increase the value a little more comfortly. And when i stop pressing the button the value has to stop the increasing.
I don't get it work...
LV 8.2
Solved! Go to Solution.
01-31-2011 10:40 AM
You would probably have to do this using either the timeout event or a user event. You would first trigger it off of the mouse down event on this button and in the timeout event continue to update the value until you get either a mouse up or mouse leave event.
01-31-2011 10:44 AM - edited 01-31-2011 10:45 AM
Yea you could do it that way and use a shift register to pass a flag to the timeout event telling it the state of the mouse button (down or up) and have it use a case structure to take action or not.
01-31-2011 10:45 AM
What are you having problems with? Is the event not triggering? Are you not understand the latching mechanism? Are you having problems with the timing? Are you using a numeric control? In this case the Value Change event should trigger whenever the up/down controls are used and held down (see first attachment). You may want to consider using 2 Boolean controls to give you better control. You can just use the Timout event of the event structure and set the mechanical action of the Boolean controls to continue to give you a True while the button is pressed (see second example). If you are still having problems then please post your code.
02-01-2011 01:53 AM
The updown2.vi does what i want. Thanks !
But i have another Problem. I want to control about 30 Values. I have made a example vi with 3 values and the first one is my test object.
When i have 30 values, the timeout event becomes a little big...
Is it not possible with the mouse down or button pressed event ? I tested it in value 1 but the mouse down only calls once and so the value only gets one higher.
Or put a loop in it, which increases the value and detects mouse up to end the loop? I've tested it, but i can't get it work (see value 2). The end of the loop is the problem...
02-01-2011 01:57 AM
I want to use it for a user interface with a touchpanel. So that the user could control the values with a fingertip. And when he presses the button long down it has to automatically increase.
02-01-2011 02:58 AM
I got it !
Thanks for all help. I've got the loop ending. The problem was that the event structure has to allow the frontpanel access, so that the button could release.
See attached vi !
02-01-2011 03:27 AM - edited 02-01-2011 03:30 AM
You are doing this still way too complicated. Your code is not very scaleable, because it will be gigantic once you e.g. have 20 such buttons. There is way too much hidden code, such as all these stacked sequences and inner loops. Very convoluted. Lots of duplicate code. You have controls as indicators, countless unneeded local variables, etc.
All you need is one loop, two event cases, and a small bit of code for any number of buttons.
Try this. See if it makes sense. (LabVIEW 8.2) 😄
(Another idea would be to wrap the buttons and the slide indicator into an x-control. Try it.)
02-01-2011 03:29 AM
Hi Ralph,
Have posted another way to go. Might be of some interest to you. I have made a subvi that you can simply duplicate for every control you want to add the increment/decrement feature too.
Rgs,
Lucither
02-01-2011 03:34 AM
Sorry, didnt realise you had 8.2
Is re-attached in 8.2
Rgs,
Lucither