Home › Forums › General › Programming › Lua in Ctrlr – list of frequently used commands › Reply To: Lua in Ctrlr – list of frequently used commands
May 20, 2014 at 12:14 pm
#23678
Hi
add this example : a shared textbox parameter name/value linked to one/several
mods + a default color for default value (here 64)
--
-- Called when a modulator value changes
-- @mod http://ctrlr.org/api/class_ctrlr_modulator.html
-- @value new numeric value of the modulator
--
Slidval64 = function(mod, newValue)
sl64 = mod:getComponent()
function ValueCallback(timerId)
if timer ~= nil then
timer:stopTimer(40)
end
panel:getComponent("my label text"):setText(mod:getModulatorName())
end
panel:getComponent("my label text"):setText(sl64:getComponentText())
if newValue ~= 64 then
sl64:setProperty("uiSliderThumbColour",col1:toString(),false)
sl64:setProperty("uiSliderTrackColour",col2:toString(),false)
sl64:setProperty("uiSliderValueTextColour",col5:toString(),false)
else
sl64:setProperty("uiSliderThumbColour",col3:toString(),false)
sl64:setProperty("uiSliderTrackColour",col4:toString(),false)
sl64:setProperty("uiSliderValueTextColour",col6:toString(),false)
end
timer:setCallback (40,ValueCallback)
timer:startTimer(40,500)
end
colors are defined elsewhere(Called when the panel is created).ex col4 = Colour(0x5dc68e6c)
It is possible to share parameter name/value directly on the modulator too : just use the adequate properties