Ok I am almost there, I have the switches (buttons) logic working in display.lua, and the buttons turn on and off properly when I click them.
I am not using an RT property anymore, just the doc ones for the UI elements (custom display buttons)
The only problem is.... renderBatch is not seeing the properties change!!!
I have 8 channels each with a solo button, the hdgui_2D.lua is like this (just showing the ch1 here)
Code: Select all
-- CH1_SOLO_PB
front_widgets[#front_widgets + 1] = jbox.custom_display {
graphics = { node = "CH1_SOLO_PB" },
background = jbox.image{ path = "solo_off" },
display_width_pixels = 50,
display_height_pixels = 50,
draw_function = "SwitchDraw1",
gesture_function = "SwitchGesture1",
values = { "/custom_properties/ch1_solo_pb",
"/custom_properties/ch2_solo_pb",
"/custom_properties/ch3_solo_pb",
"/custom_properties/ch4_solo_pb",
"/custom_properties/ch5_solo_pb",
"/custom_properties/ch6_solo_pb",
"/custom_properties/ch7_solo_pb",
"/custom_properties/ch8_solo_pb"
}
}
Motherboard is as before ( x 8)
Code: Select all
custom_properties = jbox.property_set{
document_owner = {
properties = {
ch1_solo_pb=jbox.boolean{default=false,ui_name=ui_text_ch1_solo_pb,ui_type=ui_selecter_switch,},
display.lua:
Code: Select all
format_version = "1.0"
--------------- Definition ----------------------
function gestureFunction(handlers)
return function(props, di, sp)
local gesture_definition = {
custom_data = {},
handlers = handlers
}
return gesture_definition
end
end
function switchTapFunction(input)
return function(props, di, gi, cd) return handleSwitchTap(props,input) end
end
function switchDrawFunction(input)
return function(props, di, dr) return handleSwitchDraw(props,di,input) end
end
SwitchGesture1 = gestureFunction{ on_tap = "SwitchTap1" }
SwitchTap1 = switchTapFunction(1)
SwitchDraw1 = switchDrawFunction(1)
SwitchGesture2 = gestureFunction{ on_tap = "SwitchTap2" }
SwitchTap2 = switchTapFunction(2)
SwitchDraw2 = switchDrawFunction(2)
SwitchGesture3 = gestureFunction{ on_tap = "SwitchTap3" }
SwitchTap3 = switchTapFunction(3)
SwitchDraw3 = switchDrawFunction(3)
SwitchGesture4 = gestureFunction{ on_tap = "SwitchTap4" }
SwitchTap4 = switchTapFunction(4)
SwitchDraw4 = switchDrawFunction(4)
SwitchGesture5 = gestureFunction{ on_tap = "SwitchTap5" }
SwitchTap5 = switchTapFunction(5)
SwitchDraw5 = switchDrawFunction(5)
SwitchGesture6 = gestureFunction{ on_tap = "SwitchTap6" }
SwitchTap6 = switchTapFunction(6)
SwitchDraw6 = switchDrawFunction(6)
SwitchGesture7 = gestureFunction{ on_tap = "SwitchTap7" }
SwitchTap7 = switchTapFunction(7)
SwitchDraw7 = switchDrawFunction(7)
SwitchGesture8 = gestureFunction{ on_tap = "SwitchTap8" }
SwitchTap8 = switchTapFunction(8)
SwitchDraw8 = switchDrawFunction(8)
local colorOn = { r = 0, g = 255, b = 0, a = 200 }
local colorOff = { r = 0, g = 0, b = 0, a = 0 }
function handleSwitchTap(props,input)
local changes = {}
changes[input] = not props[input]
return { gesture_ui_name = jbox.ui_text("ch1_solo_pb"),property_changes = changes }
end
function handleSwitchDraw(props,di, input)
local switchRect = { left = 0, top = 0, right = di.width, bottom = di.height }
if (props[input]) then
jbox_display.draw_rect(switchRect, colorOn)
else
jbox_display.draw_rect(switchRect, colorOff)
end
end
-- nothing to do
NoOpDraw = function(props, di, dr)
end
and this renderBatch code does not log anything when any of the first 3 channel solo buttons are pressed:
Code: Select all
fCH1_Knob_SoloSelected = JBox_GetBoolean(JBox_LoadMOMProperty(fCH1_Knob_Solo_PropertyRef)); //BM t or f ( x8)
if (fCH1_Knob_SoloSelected || fCH2_Knob_SoloSelected || fCH3_Knob_SoloSelected ) {
TJBox_Value aVal = JBox_MakeNumber(fCH1_Knob_SoloSelected);
TJBox_Value bVal = JBox_MakeNumber(fCH2_Knob_SoloSelected);
TJBox_Value cVal = JBox_MakeNumber(fCH3_Knob_SoloSelected);
TJBox_Value values[] = {aVal,bVal,cVal};
JBOX_TRACEVALUES("fCH1_Knob_SoloSelected: ^0,fCH2_Knob_SoloSelected: ^1,fCH3_Knob_SoloSelected: ^2", values, 3);
}
Sorry for such a big post, I think I am missing something simple here...
Murf.