05-31-2012 04:51 AM
Hi guys,
My application obtains data and then outputs this into a table which updates after each set of data is read. This part works fine, however I also require the user to be able to hold down one of two buttons to control control the function of an actuator (forwards and rearwards). To explain this further, when one of these buttons are pressed a voltage is output, when released the voltage is reset to zero. However, while the button is held down the table does not continue to update, when the button is released the table then updates through all the queued values. I understand that this is most likely a problem with the holding of the button causing the other user interface events to not be processed. I have therefore tried using ProcessSystemEvents(), ProcessDrawEvents(), and experimented with using an async timer to control the updating of the UI through the use of PostDeferredCallback(), all without success.
If anyone can help with a solution that would allow me to perform both of these required functions simultaneously it would be greatly appreciated!
Thanks in advance
Ben
Solved! Go to Solution.
05-31-2012 05:57 AM - edited 05-31-2012 06:01 AM
Could you use a toggle button instead of a simple button to be hold down? If yes, then in the button callback you could simple test the value of the toggle (1 if pressed, 0 if released) and operate turn on/off the output voltage to the actuator. You'll have a commit event every time the operator changes button state. (you may need to apply some security limit switch or timeput on the control in case the user forgets to turn the toggle off: the situation is similar to a three-state switch that controls a motorized window blind).
05-31-2012 07:12 AM
Thanks Roberto, I have previously experimented with a toggle button for this application but wanted to avoid it as I found that when handing the application over to others they found it far less intuitive and tried using it like a press and hold button. I would therefore like to avoid having to click a toggle button once to start and again to stop if at all possible.
05-31-2012 07:47 AM
Problem solved, by simply just swallowing the event I am able to achieve the desired functions!
Cheers
Ben