LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

update knob value only when mouse button is released?

Is it possible to modify the knob controls so that the value is updated only when I release the mouse button?
I want to control a power supply via GPIB, use knobs in my front panel, and send a new GPIB command every time there is a change to the knob. The problem is, that the knob's value already changes during the turning of the knob, but I only want to have a new value when I release the knob. Thanks for any ideas!
0 Kudos
Message 1 of 5
(2,748 Views)
With LabView 6.1 you can by using the event structure.
You can select the mouse up event to trigger the GPIB command
0 Kudos
Message 2 of 5
(2,748 Views)
Unfortunately I don't work with LabVIEW 6.1 yet, but with Version 6.0.2. Is there a way to accomplished the same with 6.0.2 as well?
0 Kudos
Message 3 of 5
(2,748 Views)
Res Christen wrote:
> Is it possible to modify the knob controls so that the value is
> updated only when I release the mouse button?
> I want to control a power supply via GPIB, use knobs in my front
> panel, and send a new GPIB command every time there is a change to the
> knob. The problem is, that the knob's value already changes during the
> turning of the knob, but I only want to have a new value when I
> release the knob. Thanks for any ideas!
There are libraries available that can read the mouse button status; I
found one at http://www.hamiltondesign-consulting.com/Utils.htm
It may be possible to do some checking for a value change on the control
using a shift register on a loop and then only updating the GPIB if
a change is detected and the mouse i
s "up". The question is whether or
not that is going to be reliable.
The simplest solution I can see would be just to have an "Update" button
on the panel; the user sets the value on a dial but this is only sent to
the instrument when this extra button is pressed (possible Mechanical
Action set to "Latch When Pressed" or "Latch When Released") Even this
solution will involve a bit of polling.
Hope this is of some help.

Dave R.
0 Kudos
Message 4 of 5
(2,748 Views)
There are two techniques I have developped in LV 5.1 to detect when the user releases the mouse to latch a value. See the attached files. I'll explain a little since they are tricky.

MouseTrack.llb: the VI detects when the user is editing a control by polling controls for changes. When a change is detected on a control, I make visible a transparent picture control that covers the whole panel. This picture control doesn't get the mouse focus as long as the user keeps editing the control. When the user is done with the control and releas the mouse, then the picture control gets the mouse focus, an event that is detected using the mouse position attribute.

Latchslide.vi: The slide has two sliders. one is transparent and covers most of the
control area. This slider is operated by the user. On the diagram, this slider is constantly pushed offscale by writing on a local variable. If the slider stays offscale, that means that the user has released it. The value can be latched. If the slider stays in scale, that means that the user is still holding the slider. The second slider is used to display the actual value of the transparent one.

Of course, LabVIEW 6.1 and the event structure renders this obsolete. Enjoy.


LabVIEW, C'est LabVIEW

Download All
Message 5 of 5
(2,748 Views)