scripting:samples:osd_values
OSD Value Controls
Value controls provide an interface that lets the user select a value which is then provided to your script when they press a button. Setting up a value control requires you to provide initial, minimum and maximum values. Getting the resulting value back to your script is done using a reference to the name of the value control which is made using the & symbol. Here is a 'simple' example:
$itemNum = 40 $initialVal = 10 $minVal = 0 $maxVal = 20 osdcreate(OSDBUILDING,"ExampleOSD", "Example" ) osdadd(TEXTRIGHT, 340, 134, 0, 0, "", "Select amount:") osdadd(VALUE, 350, 130, 100, 25, "numgoods", "$initialVal|$minVal|$maxVal") osdadd(EXITBUTTON, 150, 200,300,40, "Export|$itemNum|&numgoods", "Select") osdactivate()
In this example, when the user clicks 'Select' they're triggering the 'Export' EXITBUTTON with two parameters, the first being '$itemNum' (i.e. 40), and the second being whatever value they've entered in the “numgoods” control. i.e.
Event( "OSDSelect", "ExampleOSD:Export" ) { $itemNum = $gParam[1] $valueSelected = $gParam[2] ... }
scripting/samples/osd_values.txt · Last modified: 2023/02/28 07:07 by mit