LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slider: how can I programatically show only the digital display until "mouse enter event"?

Solved!
Go to solution

Hello

 

I'm building a User Interface using a slight modified "Horizontal Flat Slider" from Flatline add-on available in VI Package Manager.

 

And I need to show only the digital display of the control until a "Mouse enter" event is generated. Then, a "Mouse leave" event will hide the slider again.

In short, I want that all sliders controls in my VI were hidden until the user points the mouse cursor in the control.

 

1) I could not find a Property Node to show/hide the slider, is there a property for this effect?

2) My workaround: Turn the slider transparent, then fill with the right colors inside the Mouse events. But I cannot find a Property Node for the "increment" and "decrement" buttons. I can turn these buttons transparent with the paintbrush tool. How can I programatically do this?

 

Here's a example of my slider:ForumNI.png

 

0 Kudos
Message 1 of 7
(2,383 Views)

This is the kind of thing which will actually work reasonably well as an XControl, particularly if you have more than one with the same logic. You can try figuring this out yourself, since it's actually a good way to learn XControls, but I guess you caught me at a good time, so here's a crude example of such an XControl (LV 2015). It doesn't do everything nicely, but it shows the basic idea.


___________________
Try to take over the world!
Message 2 of 7
(2,359 Views)

Thanks for the advice.

 

Xcontrols sounds like a good idea, but my research indicates a grave problem. The container doesn't expose the pre-defined properties and methods. The Xcontrol should inherit from the base data type so that any code written is only to extend or override the existing properties and methods.

Take for example this slider. If I want to simply change the "Scale Range"  for the different controls. I have to re-implement all the existing Minimum Maximum, Increment, Minor Increment and Start, etc. Right?

 

But I can just right click the slide and change these options inside "Slide Properties". I didn't saw this option inside the Xcontrol. There's how to add these functionalities?

0 Kudos
Message 3 of 7
(2,334 Views)

@mthheitor wrote:

If I want to simply change the "Scale Range"  for the different controls. I have to re-implement all the existing Minimum Maximum, Increment, Minor Increment and Start, etc. Right?

Correct. You'll probably need fewer properties than you think you need, so it might still be worth it. You could also try looking at this, which I believe is supposed to generate the properties for you, but it's probably quicker to build a few by hand than to install and learn it - https://lavag.org/files/file/33-xcontrol-inheritance/

 

You can also handle mouse down and shortcut menu activation events inside the XControl to display a settings dialog, but you will have to write it yourself.

 

Another option you can try is creating a daemon process to do the logic instead of the XControl. This could simply be a reentrant VI which you provide with a reference to the specific controls and then register for the events and so on. This will require several terminals on the BD, one for each of the controls and will require you to stop it as well.


___________________
Try to take over the world!
Message 4 of 7
(2,310 Views)

I think Q controls might be option for this. http://sine.ni.com/nips/cds/view/p/lang/nl/nid/214228

 

I still haven't used these myself, but it looks like a good approach.

 

0xDEAD

Message 5 of 7
(2,304 Views)

For each of your slider controls, add an ordinary numeric control, and place it over the digital display of the slider.

Use Mouse Enter and Mouse leave events of the numeric control to change the visibility of the slider.

Use the Value change event of the numeric to write to a local variable of the slider.

Use the Value change event of the slider to write to a local variable of the numeric .

 

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 6 of 7
(2,296 Views)
Solution
Accepted by topic author mthheitor

Paul's suggestion is probably the easiest. Another option would be to have a color box constant indicator set to your background color that could appear and disappear, though it might "eat" some of your mouse enter/leave events.

Message 7 of 7
(2,283 Views)