I have a problem with LUA that I do not know very well how to explain.I faced him last summer and did not solve it. I try again now.
I want to control some properties of the Tracks through a Checkbox with true/false.The code that I have at the time is the following:
Function for notifier of checkbox_peet_trvol (¿?):
function show_trvol(idx)
end
The checkbox = checkbox_peet_trvol (for control the " volume_column_visible" of a especific track):
checkbox_peet_trvol = vb:checkbox { id = 'cbox_peet_trvol', value = false, notifier = function(idx) show_trvol(idx) end, tooltip = 'Volume Column Track' }
Note: focus attention on " value" and " notifier".Here is the problem.
Propieties of track:
local track = {}
track.solo_string = { name = 'Solo String' , color = PEET.TR.CR_RD01 , color_blend = 14 , collapsed = FALSE , volume_column_visible = checkbox_peet_trvol.value }
Note: focus attention on " volume_column_visible".Here is the rest of the problem, With the theme of the true and false.
Function to insert a track:
function in_tr( tid , track_setting )
local song = renoise.song()
local tid = song.selected_track_index + 1
song:insert_track_at( tid )
for parameter_name, parameter_value in pairs( track_setting ) do
song:track( tid )[parameter_name] = parameter_value
end
song:track( tid ).visible_effect_columns = 0 , 1 , false
song.selected_track_index = song.selected_track_index + 1
end
Function to insert the trackthrough a popup:
function peet_fn_A01( popup ) -- ( x03 )
local function peet_fn_A01_01()
local song = renoise.song()
local tid = song.selected_track_index
in_tr( tid , track.solo_string )
end
local function peet_fn_A01_02()
--content
end
local function peet_fn_A01_03()
--content
end
if popup == 1 then peet_fn_A01_01()
elseif popup == 2 then peet_fn_A01_02()
elseif popup == 3 then peet_fn_A01_03()
end
end
Through a drop-down list (popup) and a button I invoke specific functions to insert tracks (and groups) with certain characteristics.My idea is to use several checkbox to be able to change the true and false properties of the track to be inserted.For example:
- Track property --> volume_column_visible = true or false
- The checkbox can change your " valor" true or false through your notifier (“false” by default).
The case is that I want with the mouse click to activate through the tool the checkbox (value true ), so that the property volume_column_visible takes the value true…and vice versa.
Is there any way to do this?
Actually, I want to use up to 4 checkboxes, to control:
- volume_column_visible
- panning_column_visible
- delay_column_visible
- sample_effects_column_visible
Some related information:
--Pattern editor columns (Renoise.Song.API.lua).
renoise.song().tracks[].volume_column_visible, _observable
-> [boolean]
renoise.song().tracks[].panning_column_visible, _observable
-> [boolean]
renoise.song().tracks[].delay_column_visible, _observable
-> [boolean]
renoise.song().tracks[].sample_effects_column_visible, _observable
-> [boolean]
--renoise.Views.CheckBox (Renoise.ViewBuilder.API.lua)
checkbox.value
-> [boolean]
-- Valid in the construction table only: Set up a value notifier.
checkbox.notifier
-> [function(boolean_value)]
-- Valid in the construction table only: Bind the view's value to a
-- renoise.Document.ObservableBoolean object. Will change the Observable
-- value as soon as the views value changes, and change the view's value as
-- soon as the Observable's value changes - automatically keeps both values
-- in sync.
-- Notifiers can be added to either the view or the Observable object.
checkbox.bind
-> [ObservableBoolean Object]
Any ideas?