LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scrollbar Control Question

I have a scrollbar control that is used to set a value within a product. The scrollbar is scaled in real world units but has to be sent to the product in % (the processor demands % and our sales guys demand the software displays units!!).

My problem is one of rounding when i read the % back from the unit and scale it back into units, it is sometimes rounded up/down. If I set the increment of the scrollbar to 5 and the page size to 5, all is ok (and I can live with incrments of 5). The only problem is when I drag the scrollbar manually I can still get values of 1,2,3 etc. Is there a way to get a manual scroll to snap to increments of 5?

Thanks in advance!
0 Kudos
Message 1 of 11
(3,658 Views)

ssk,

Can you please post your code.  Regards, SS



0 Kudos
Message 2 of 11
(3,644 Views)
Do you mean the Slider Control instead of scrollbar?  You can set the slider control to represent U32 (or U16 or 😎 and then set the Data Range properties as such:  Uncheck the Use Default Range box.  Set Minimum to 0 (or whatever number you wish).  Set the Maximum to 100.  Set the Increment to 5.  Then when you move the slider, it will jump in increments of 5, like 0..5..10..15.....  You might have to go to the Scale tab in the properties box and set the scale range to your min and max values.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 11
(3,620 Views)
Thanks for your comments.

I am using a scrollbar (not slider) and have set increment and page size to 5. This works fine when you press the increment/decrement controls at the end of the scrollbar (jumps 5 units at a time).

If you drag the slider though, any value can be selected. I cannot use a slide control as I need the increment/decrement function of the scrollbar.

vi attached.

Thanks

ssk
0 Kudos
Message 4 of 11
(3,592 Views)

Hi ssk,

i think one solution for you is to program this function yourself. See the attached example.

Mike



Message Edited by MikeS81 on 02-27-2008 02:48 AM
0 Kudos
Message 5 of 11
(3,587 Views)
Thanks Mike,

You beat me to it, I was just doing the same thing!!

ssk
0 Kudos
Message 6 of 11
(3,582 Views)
It looks as though you have reached a solution with this but i feel that event structures might be a slight over kill here. Correct me if I have missed the point totally but can you not just set the representation to integer, then scale the data up by 5 before its use throughout your program. This will give you increments of 5 both on your scroll bar and on your dragging slide.
 
best regards
Graham Green
Software Product Marketing
NI | Emerson
0 Kudos
Message 7 of 11
(3,575 Views)
I don't get it.  If you display the Digital Data control for the slider, that control has increment/decrement buttons.  It looks different than a scrollbar, but its functionality is the same.  I would rather use a slider with digital display than to have to use a scrollbar with extra coding.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 11
(3,551 Views)
The scroll bar and slider numeric controls within labview are inherently the same object. They have the same properties just a different visual look,  it is totally the choice of a developer which one they decide will give a higher intuitive aspect to the end user as the properties and data representation are the same.
Graham Green
Software Product Marketing
NI | Emerson
0 Kudos
Message 9 of 11
(3,542 Views)

I think there is one big difference.  The scroll bar doesn't have an option to coerce the data and/or page to nearest number (under data entry).  This allows the user in this case to drag the scroll bar to a value other than on an increment of 5. 

 

Otherwise if there was a coerce option I believe the two would function identically.  Run the attached vi and slide both and you will see what I'm referring to.  Maybe this should be a feature request.

 

Regards,

 

SS



0 Kudos
Message 10 of 11
(3,532 Views)