03-22-2014 06:47 PM
03-24-2014 03:34 PM
Could you post a small example of what you are seeing on the forum? It is not completely clear to me what you are trying to do and what is not working.
03-24-2014 06:25 PM
Thank you very much for the interest. Sorry, I am new to LabVIEW. I found the solution from typedef, had to go into: Tool Palette Set Color > Tab > Transparent. Thank you very much.
04-14-2014 10:59 AM
Apologies for a long post; but I've just been having hours of "fun" with sliders as well, and then stumbled upon this thread.
So I have a syringe pump. I want a control that displays the current level, and has a pointer to let the user set a new desired level. To complicate matters, the new target shouldn't be sent to the syringe pump until the user lets go of the control as it may take a few seconds to move to its new target, and it doesn't like being interrupted once it's started.
Corollaries include disabling the control until the syringe reaches the target it was sent.
The first difficulty was displaying the current level but not letting the user modify it. This is accomplished by having an indicator in front of a control. The front one (the indicator) displays the level, and has a transparent needle. The needle was resized to be entirely above the level scale before making it transparent, so that the indicator's needle are doesn't mask events from the needle of the back one.
The second difficulty was figuring when to send a command to the syringe. "Value changed" is no good, as I don't want to keep sending commands every time the user moves a pixel. "Mouse up" works, sort of, unless the user moves away from the control (in which case the pane's "Mouse up" event can be used) or away from the window altogether (in which case I seem to be stuffed).
The third difficulty is letting the target be set elsewhere (by a script that may or may not be running). This isn't so hard; the script (emulated by the extra control and pushbutton) sets an LED, whose 'value changed' event is combined with the 'mouse up' on the control.
Some questions that I'm hoping somebody might be able to help with:
1. How to force the drag of the needle to end, and revert to its previous value, when the user navigates away from the control, like it would in other Windows apps. Is there a way to programmatically terminate a drag?
2. An alternative to the above would be to limit the mouse movement once a drag starts until the mouse is released. This seems wrong, however - having a control reset if the user changes their mind about moving it is a good thing.
3. How to recognise clicks on the indicator and let the control get them. I guess this can be fudged by reading the mouse click coordinates if the indicator is clicked, and generating another event to pass them to the control, which then has to work out where the pointer should be. This all sounds rather prone to going wrong if the control is ever resized, moved and so on.
4. How to fix the flickery update of the level?
I did wonder if Xcontrols can do anything for me, but it seems that I need the professional version to do that. I can't imagine persuading somebody to spend £3k to upgrade just to fix one slide control.
Any help very welcome!
thanks
John
04-14-2014 11:15 AM
Oops. Didn't save before posting. Try again ...
04-14-2014 11:28 AM
This all seems way too convoluted. As a first step I would get rid of most local variables and keep states in shift registers.
04-14-2014 01:33 PM
Hm, you're right. Wood, trees etc. I've tidied it up a bit. But I still can't fix any of the original issues!
04-14-2014 02:36 PM - edited 04-14-2014 02:37 PM
Here is some attempt at a simplification. Modify as needed. For example you could make the slider tranparent while the slide is disabled.
04-14-2014 04:34 PM
Thanks - that's very useful, as it gets rid of the flickering updates.
For what I'm trying to do, though, using the 'value change' event on the slider doesn't work, as I don't want to send a command (and lock the control slider) as soon as it's moved (the syringe can take a minute to travel its full length); only when the user lets go. So I used 'mouse up' to decide when to do the actual update, and kept the 'value change' to update the shift register.
Here's an amalgmation of thw two VIs that works, as far as it goes; but I'm still stuck with what to do if the user moves the mouse away from the control, and I never get a 'mouse up'?
thanks, john
07-09-2014 06:19 AM
So I'm back to this "old chestnut" after some other things to attend to.
A curious bug has emerged: there's a certain area at the left of the 'target' pointer (but still on the pointer) that I can click on, and it actually starts a drag of the 'current' level instead. A couple of pixels to the right of the 'current' level slider.
Messing with the 'activeslider' property doesn't seem to help me.
I can't simply dump the 'mousedown?' event as reading 'activeslider' still says the pointer is active. By the time I get 'mousedown', 'activeslider' says the level is now active, but it's a bit late by then. I can't see any way to terminate a drag in progress programatically.
Any ideas?
thanks
John