UI Interest Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Customizable AND programmable slider

Solved!
Go to solution

I need to make a simple slider input panel that pops up when my HMI user wants to enter a value that spans a broad range. I need to provide "bump up/down" buttons and a numeric input option, so I decided to start with the horizontal Classic slider and customize it. (The "bump" buttons are those triangles on the left and right that change the value by the increment each time they're pressed.)

classic_slider.png

I got it looking the way I want, but when I went to set its properties from the block diagram, I saw that I can't write the "Data Entry Limits" value. Is there any way to set the slider's range programmatically? I see that the Modern version lets you set the limits, but it lacks the "bump" buttons.

data_entry_limits_property.png

I'd also like to know how to detect a click on the digital display: I want to pop up a numeric input panel (another VI) to allow the operator to punch in a number directly through the HMI if they prefer.

I'm going to have to write an XControl for this, aren't I?

0 Kudos
Message 1 of 6
(5,920 Views)

Here is a subvi I made to detect a click on a digital display.  I put this in an event loop to detected ether a right click event and launched from a menu or as a double click event.

detect click on ctrl vi.png

To set the data limits I don't really understand your problem, you should be able to set this using property nodes:

range and limits.png

X controls are pretty strait forward, and I did make one that does what you are discribing.

Message 2 of 6
(3,476 Views)

I'm confused --> is this what you're trying to do?  Seems to work for me (LV2011)

vi_snippet.png

I don't think you need an XControl but if you're reusing it a bunch of places it's probably worth it.

Message 3 of 6
(3,476 Views)

You can implement data limits yourself using the Value changed? event.  Check the value in the event.  If it is out of range, either reject or coerce it before passing it on.

And yes, you should probably write an XControl if you are using this more than once anywhere.

0 Kudos
Message 4 of 6
(3,476 Views)

Wow, thanks for the great responses guys! joshe and Simon, thanks for the code snippets. DFGray, tha'ts a good idea for a workaround.

Simon, for whatever reason, I still can't get either of those properties to be writable. I added my control file to the original post: can you try it and let me know what you see?

0 Kudos
Message 5 of 6
(3,476 Views)
Solution
Accepted by David_Staab

Ah, it's because I had it set as a strict typedef. Evidently that means you can't change the range limits. Darn...I guess I won't be able to enforce visual style, size, and layout thorugh the type definition. Oh, well.

Thanks everyone, it's working great now!

0 Kudos
Message 6 of 6
(3,476 Views)