Home › Forums › General › Programming › UI trickz – how would you like to see this coded? › Reply To: UI trickz – how would you like to see this coded?
yes yes 🙂 it was interesting to try this out, by trying
to declare an ‘assign’ method just using Component: didn’t work.
i did manage to combine my 2 method sides into a single method
– by the time i’d finished the main ‘partialOps’, the other one
wasn’t needed, i realised. so that was a success. but then i
thought: what if i could pre-create the mini functions/local functions
in a ‘miscellaneous’/’library’ type method, and call them from there?
for this to be efficient, i’d need to pre-declare everything, in an
‘assign’ method.
that has not been loading, so i looked at your DSI panel again, and
saw that you call ‘assignModulators’ in your panel startup method.
so i’ll try again later with that.
but look at this, the current declarations (ha Mum, look no Modulators)
– this works –
first:
function partialOps()
-- This stops issues during panel bootup
if panel:getRestoreState() == true or panel:getProgramState() == true
then return end
--note: now includes levelZero methods!
--modulators
--partials_onoff controls views and LEDs
local p1 = panel:getModulatorByName("Partial1_OnOff_Pt1"):getModulatorValue()
local p2 = panel:getModulatorByName("Partial2_OnOff_Pt1"):getModulatorValue()
local p3 = panel:getModulatorByName("Partial3_OnOff_Pt1"):getModulatorValue()
local p4 = panel:getModulatorByName("Partial4_OnOff_Pt1"):getModulatorValue()
--tvaLevel zero is same as partial Off, AND with partial onoff
local l1 = panel:getModulatorByName("tvaLevel_p1pt1"):getModulatorValue()
local l2 = panel:getModulatorByName("tvaLevel_p2pt1"):getModulatorValue()
local l3 = panel:getModulatorByName("tvaLevel_p3pt1"):getModulatorValue()
local l4 = panel:getModulatorByName("tvaLevel_p4pt1"):getModulatorValue()
--components
--ledTextA 1st row//normal onoff//
local ledA1 = panel:getComponent("ledText1")
local ledA2 = panel:getComponent("ledText2")
local ledA3 = panel:getComponent("ledText3")
local ledA4 = panel:getComponent("ledText4")
--ledTextB 2nd row//shows partial is at both inputs//
local ledB1 = panel:getComponent("ledText5")
local ledB2 = panel:getComponent("ledText6")
local ledB3 = panel:getComponent("ledText7")
local ledB4 = panel:getComponent("ledText8")
--tab OnClick buttons//showhide with partial onoff
local p1click = panel:getComponent("tabP1OnClick")
local p2click = panel:getComponent("tabP2OnClick")
local p3click = panel:getComponent("tabP3OnClick")
local p4click = panel:getComponent("tabP4OnClick")
--tab showhide
local tabsWGp1 = panel:getComponent("tabsWGp1pt1")
local tabsWGp2 = panel:getComponent("tabsWGp2pt1")
local tabsWGp3 = panel:getComponent("tabsWGp3pt1")
local tabsWGp4 = panel:getComponent("tabsWGp4pt1")
and then:
-- 1st pair
function doubleA1()
ledA1:setProperty("uiLabelTextColour","FF00FF00", false) --on
ledB1:setProperty("uiLabelTextColour","FFD28008", false) --on
ledA2:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledB2:setProperty("uiLabelTextColour","FF0E2B01", false) --off
end
--
function doubleB1()
ledA1:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledB1:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledA2:setProperty("uiLabelTextColour","FF00FF00", false) --on
ledB2:setProperty("uiLabelTextColour","FFD28008", false) --on
end
--
function allOff1()
ledA1:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledB1:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledA2:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledB2:setProperty("uiLabelTextColour","FF0E2B01", false) --off
end
--
function bothOn1()
ledA1:setProperty("uiLabelTextColour","FF00FF00", false) --on
ledB1:setProperty("uiLabelTextColour","FF0E2B01", false) --off
ledA2:setProperty("uiLabelTextColour","FF00FF00", false) --on
ledB2:setProperty("uiLabelTextColour","FF0E2B01", false) --off
end
(etc.)
and then a load of options like this (the 16 configs 0000-1111):
-- 1 --bin0001//only checkp1, p2 is off,no need to compare 2nd pair, p3 and p4 are off//
elseif p1 == 1 and p2 == 0 and p3 == 0 and p4 == 0 then
panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x41, 0x10, 0x16, 0x12, 0x04, 0x00, 0x0c, 0x01, 0x6f, 0xf7}))
if l1 ~= 0 then doubleA1() allOff2()
elseif l1 == 0 then allOff1() allOff2()
end
p1click:setProperty("uiButtonTextColourOff","FF1291DF", false)
p2click:setProperty("uiButtonTextColourOff","FF0E2B01", false)
p3click:setProperty("uiButtonTextColourOff","FF0E2B01", false)
p4click:setProperty("uiButtonTextColourOff","FF0E2B01", false)
tabsWGp1:setVisible(true)
tabsWGp2:setVisible(false)
tabsWGp3:setVisible(false)
tabsWGp4:setVisible(false)
--struct12:setVisible(true)
--clikSt12:setVisible(true)
--struct34:setVisible(false)
--clikSt34:setVisible(false)
(etc.)
which is looking ok to me 😀 .. better if i can work in those other
actions, but ok for now, and much reduced. note that i don’t mention
Modulator for any of the label text modulators, i go straight to
component.
???