GMFaderSlider:
Filter:
GraphicalModule/Classes (extension) | GUI > Graphical Module

GMFaderSlider
ExtensionExtension

A simple slider for creating graphical interfaces

Description

GMFaderSlider is an easy to use customisable slider.

It inherits from the GMZZSlider class, and is only responsible for graphical specifications. See GMZZSlider for non-graphical properties settings.

Its color can be configured so that it becomes transparent as the value is getting lower. The transparency is independant from the selected scale mapping : it is always linear. This means the lower the color is, the lower the value is relatively to the maximum value. This visual hint is useful when using non-linear scale (a slider at the same position would display different colors on an exponential scale and a logarithmic scale). Setting the minimum transparency to 1 will disable the fading effect.

By default, the slider will display its value, truncated to a certain number.

In some certain cases, the built-in slider scales won't suit your usage, and you will need to post-process the slider value within its action function. In this case, you should also modify the displayFunction of the slider so that the displayed value is updated accordingly :

Class Methods

.new

Creates a new instance of GMFaderSlider.

By default, its graphical properties are defined by its associated GMStyle. This means that creating sliders with different colors implies creating multiples GMStyle. The slider color corresponds to the mainColor property. The font color of the displayed value corresponds to the valueFontColor property.

Returns:

a GMFaderSlider instance.

Instance Methods

Graphical settings

.minAlpha

Sets or gets the minimum alpha value that the slider color can reach when the value is equal to min. Set to 1 to disable the fading effect.

Arguments:

aNumber

A Float that should be between 0 and 1.

.sliderRatio

Sets or gets the size of the slider relative to the widget size.

Arguments:

aNumber

A Float that should be between 0 and 1.

.displayValue

Sets or gets wether the value should be displayed.

.centerValue

Sets or gets wether the value should be centered on the widget.

.roundValue

Sets or gets the number the displayed value is truncated to.

.displayFunction

Sets or gets the Function that will be used to adapt the displayed value if needed (see above). Set to nil to disable.

.fontRatio

Sets or gets the size of the displayed value font relative to the widget size.

Arguments:

aFloat

A Float that should be between 0 and 1.

.displayHelpers

Sets or gets wether helpers should be displayed.

.drawHelpers

Deprecated. Use displayHelpers instead.

.helpersStyle

Sets or gets the helpers style. Valid values are either \line or \dot.

.helpersRatio

Sets or gets the size of the displayed helpers relative to the widget size. When using \dot helpers, the value will be clipped if this would cause the dots to overlap.

Arguments:

aNumber

A Float that should be between 0 and 1.

.centerHelpers

Sets or gets wether helpers should be centered on the widget. Only relevant with line helpers.

Internal Methods

.draw

The Function associated to the View drawFunc. Shouldn't be modified.

.prDrawSlider

.prDrawValue

Examples

Here's a demo of different helpers configuration :

Copy-paste templates :

Amp :

Freq (mapping imprecisions at certains values) :

Panner :

Exp scale (mapping imprecisions at certains values) :