---
title: "BasicSliders Collection"
canonical: "https://docs.cuesystem.com/space/CVCGC/400850992/BasicSliders%20Collection"
format: markdown
---
> Macro (toc)

---

# Description

This graphic collection includes HorizontalSlider and VerticalSlider. Both objects simulate a classic linear potentiometer. It allows to set and display an analog value like volume, temperature, light level, etc. Minimum and maximum values are simply set using properties as well as parameters of scale drawing. Also, five flood colors can be simply selected using the appropriate property. Moreover, it is possible to disable a slider. In this case, the slider appears semi-transparent.

The following types of BasicSliders are available

> Macro (children)

Both sliders have the same properties, functions and events described in this section. The following figure shows the basic parts of a slider.

![image](media://985b03c1-bc10-44c7-8957-f734668f5081)

# Common Properties

|  |  |  |  |  |
| --- | --- | --- | --- | --- |
| Property Name | Data Type | Allowed Values | Default Value | Description |
| Behavior |
| AutoSetValue | Boolean | True False | False | If True the slider flood value follows the knob position. If False the slider flood value has to be set via function SetValue otherwise knob jumps back to flood value after SnapTime. |
| DefaultValue | Double | Any | (Minimum + Maximum) / 2 | Initial value of slider flood after reset |
| Enabled | Boolean | Any | True | Flag showing if slider is enabled or not. |
| SnapTime | Time | Time | :1.0 | When AutoSetValue = False knob jumps back to flood value after this time. |
| SnapToFinger | Boolean | True False | True | If True whole area of slider is active and knob jumps to touch position. If False only knob area is active to change slider value. |
| Appearance |
| ObjectColor | Long | 1 = blue  
2 = green  
3 = yellow  
4 = orange  
5 = purple | 1 | Color of object |
| ShowFlood | Boolean | Yes  
No | Yes | Highlight of the flood |
| ShowScale | Boolean | Yes  
No | Yes | Display scale or not |
| Scale |
| DivisionInterval | Double | > 0 | 10 | Interval between two scale divisions |
| Maximum | Double | <> Minimum | 100 | Value of right (top) end of slider scale |
| Minimum | Double | <> Maximum | 0 | Value of left (bottom) end of slider scale |
| OriginPosition | Double | In interval between Minimum and Maximum | 50 | Value, from which scale is drawn |
| ShowOrigin | Boolean | Any | True | Highlight of origin position |
| StepValue | Double | Any | 0 | It is discrete step of value change. |
| SubdivisionsCount | Long | >=1 | 5 | Number of sudivisions between two divisions |

# Common Functions

## Disable 

This function sets slider disabled. Function returns True.

#### Syntax

```visualbasic
Function Disable() As Boolean
```

## Enable

This function sets slider enabled. Function returns True.

#### Syntax

```visualbasic
Function Enable() As Boolean
```

## IsEnabled

This function returns True when the slider is enabled and False when the slider is disabled.

#### Syntax

```visualbasic
Function IsEnabled() As Boolean
```

## SetAutoSetValue

This function sets AutoSetValue to newautosetvalue. Function returns True.

#### Syntax

```visualbasic
Function SetAutoSetValue(newautosetvalue As Boolean) As Boolean
```

## GetAutoSetValue

This function returns current AutoSetValue.

#### Syntax

```visualbasic
Function GetAutoSetValue() As Boolean
```

## SetDivisionInterval

This function sets interval between two scale divisions. The function returns True on success. It returns False if an error occurs (parameter is too small). In this case DivisionInterval is set internally to reasonable small value (the value depends on display resolution and display size).

#### Syntax

```visualbasic
Function SetDivisionInterval(newdivisioninterval As Double) As Boolean
```

## GetDivisionInterval

This function returns interval between two divisions.

#### Syntax

```visualbasic
Function GetDivisionInterval() As Double
```

## SetMaximum

This function sets Maximum of slider scale to newmaximum. It returns True, if newmaximum is not equal to current Minimum. Otherwise it returns False, slider scale, knob and flood disappear. In both cases newmaximum is stored in object memory.

#### Syntax

```visualbasic
Function SetMaximum(newmaximum As Double) As Boolean
```

## GetMaximum

This function returns value of right (top) end of slider scale.

#### Syntax

```visualbasic
Function GetMaximum() As Double
```

## SetMinimum

This function sets Minimum of slider scale to newminimum. It returns True, if newminimum is not equal to current Maximum. Otherwise it returns False, slider scale, knob and flood disappear. In both cases newminimum is stored in object memory.

#### Syntax

```visualbasic
Function SetMinimum(newminimum As Double) As Boolean
```

## GetMinimum

This function returns value of left (bottom) end of slider scale.

#### Syntax

```visualbasic
Function GetMinimum() As Double
```

## SetObjectColor

This function sets color of slider to newobjectcolor. Possible values are:

- 1 = blue
- 2 = green
- 3 = yellow
- 4 = orange
- 5 = purple

The function returns True on success or False if an error occurs (parameter is out of limits).

#### Syntax

```visualbasic
Function SetObjectColor(newobjectcolor As Long) As Boolean
```

## GetObjectColor

This function returns current color of slider. For possible values see command SetObjectColor.

#### Syntax

```visualbasic
Function GetObjectColor() As Long
```

## SetOriginPosition

This function sets the value, from which scale is drawn to neworiginposition. It returns True, if neworiginposition is in range between current Minimum and Maximum. Otherwise it returns False, slider scale, knob and flood disappear. In both cases neworiginposition is stored in object memory.

#### Syntax

```visualbasic
Function SetOriginPosition(neworiginposition As Double) As Boolean
```

## GetOriginPosition

This function returns value, from which scale is drawn.

#### Syntax

```visualbasic
Function GetOriginPosition() As Double
```

## SetScale

This function sets all parameters of scale (newminimum, newmaximum, neworiginposition, newdivisioninterval, newsubdivisionscount, newstepvalue) in one command. If optional parameters (newdivisioninterval, newsubdivisionscount, newstepvalue) are not used in this function, these parameters are not changed. The function returns True on success or False if an error occurs (parameter is out of limits). In both cases parameters are stored in object memory. For valid value of specific parameters see functions above.

#### Syntax

```visualbasic
Function SetScale(
  newminimum As Double, 
  newmaximum As Double, 
  neworiginposition As Double, 
  Optional newdivisioninterval As Double := 0, 
  Optional newsubdivisionscount As Long := &H7FFFFFFF, 
  Optional newstepvalue As Double := -1) 
As Boolean
```

## SetShowFlood

This function sets whether flood is visible or not.

#### Syntax

```visualbasic
Function SetShowFlood(newshowflood As Boolean) As Boolean
```

## GetShowFlood

This function returns whether flood is visible or not.

#### Syntax

```visualbasic
Function GetShowFlood() As Boolean
```

## SetShowOrigin

This function sets whether origin position is highlighted or not. Function returns True.

#### Syntax

```visualbasic
Function SetShowOrigin(newshoworigin As Boolean) As Boolean
```

## GetShowOrigin

This function returns whether origin position is highlighted or not.

#### Syntax

```visualbasic
Function GetShowOrigin() As Boolean
```

## SetShowScale

This function sets whether scale is visible or not. Function returns True.

#### Syntax

```visualbasic
Function SetShowScale(newshowscale As Boolean) As Boolean
```

## GetShowScale

This function returns whether scale is visible or not.

#### Syntax

```visualbasic
Function GetShowScale() As Boolean
```

## SetSnapToFinger

This function sets SnapToFinger to newsnaptofinger value. It returns True.

#### Syntax

```visualbasic
Function SetSnapToFinger(newsnaptofinger As Boolean) As Boolean
```

## GetSnapToFinger

This function returns current value of SnapToFinger.

#### Syntax

```visualbasic
Function GetSnapToFinger() As Boolean
```

## SetStepValue 

This function sets StepValue to newstepvalue. It returns True, if newstepvalue is greater or equal to zero, otherwise it returns False and sets StepValue to absolute value of newstepvalue.

#### Syntax

```visualbasic
Function SetStepValue(newstepvalue As Double) As Boolean
```

## GetStepValue

This function returns current StepValue.

#### Syntax

```visualbasic
Function GetStepValue() As Double
```

## SetSubdivisionsCount

This function sets number of subdivisions between two divisions. The function returns True on success. It returns False if an error occurs (parameter is less then 1). In this case SubdivisionCount is set to 1 internally.

#### Syntax

```visualbasic
Function SetSubdivisionsCount(newsubdivisioncount As Long) As Boolean
```

## GetSubdivisionsCount

This function returns number of subdivisions between two divisions.

#### Syntax

```visualbasic
Function GetSubdivisionsCount() As Long
```

## SetValue

This function sets value of slider. It returns True, if newvalue is in range Minimum – Maximum, otherwise it returns False and sets flood to full flood or no flood. In both cases newvalue is stored in object memory.

#### Syntax

```visualbasic
Function SetValue(newvalue As Double) As Boolean
```

## GetValue

This function returns current value of slider.

#### Syntax

```visualbasic
Function GetValue() As Double
```

# Common Events

## OnValueChange

This event is generated when the slider value changes. New slider value is delivered in parameter new value.

#### Syntax

```visualbasic
Event OnValueChange As Process(newvalue As Double)
```

## OnRelease

This event is generated when the object is released. New slider value is delivered in parameter newvalue. It is advisable to use only one of the OnRelease or OnValueChange events.

#### Syntax

```visualbasic
Event OnRelease As Process(newvalue As Double)
```