Name
Slider.Stringify -- setup callback for custom slider text
Function
This attribute can be used to set up a callback function that transforms a slider level into a custom slider text. The callback function you specify here will be called like a standard MUI Royale event callback, but with the following extra argument:

Value:
Contains the current slider level.

Your callback function then has to return a string that should be displayed in the slider gadget. You might e.g. want to display a nice formatted time string (hh:mm:ss) in a slider which adjusts a number of seconds. Or you need to adjust a baudrate from a hand of predefined values. Just use Slider.Stringify and you have the choice how the slider value translates into a string.

Note that you always have to pass a string specifying the name of a Hollywood function to this attribute. Never pass the function directly but always pass the name of the function as a string!

Also note that you must also set up a notification on this attribute. Otherwise the callback function will never get called.

See Notifications for details.

Type
String

Applicability
ISGN

Example
<slider notify="stringify" stringify="p_Callback" min="0" max="64"
   level="32" format="--Full--"/>

Function p_Callback(msg)
  If msg.value = 0 Then Return("Mute")
  If msg.value = 64 Then Return("Full")
  Return(msg.value)
EndFunction
The code above creates a slider for controlling sound volume. If the slider is all the way to the left, "Mute" will be displayed. If it is all the way to the right, "Full" will be displayed. Note that we use the "Format" tag in the XML file to specify an initial width for the slider knob so that it is large enough for all strings that are going to be returned by our callback.

Show TOC