7.9.7.3. The slider KeywordΒΆ

You can also use the slider keyword to add a GEL function to the Scripts menu. When you select the function from the Scripts menu, a slider object appears to control the value passed to the GEL function. Each time you move the position of the slider, the GEL function is called with a new Parameters value reflecting the new position of the slider. You can only pass one Parameters to a slider GEL function. The Format of a slider GEL function is as follows:

slider param_definition( minVal, maxVal, increment, pageIncrement, paramName )
{
statements
}

param_definition Parameters description that is printed on the slider object.

minVal An integer constant specifying the value to be passed to the function when the position of the slider is at its lowest level.

maxVal An integer constant specifying the value to be passed to the function when the position of the slider is at its highest level.

increment An integer constant specifying the increment added to the value each time the slider is moved one position.

pageIncrement An integer constant specifying the increment added to the value each time the slider is moved by one page.

paramName Parameters definition that is used inside the function.

The following example uses the slider keyword to add a volume control slider.

menuitem "My Functions";
slider VolumeControl(0, 10, 1, 1, volume)
{
/* initialize the target variable with the Parameters passed by the slider object. */
targVarVolume = volume;
}

The menu entry created by the code above is:

../_images/gel_slider_menu.png

The slider is:

../_images/gel_slider.png

Warning

the specified variable targVarVolume must be part of the code loaded to the target, otherwise the operation will trigger an error. Also, the target must be halted, have Real-time Mode enabled or the option Halt the target before any debugger access must be enabled in the Debug Properties.