Reply To: Radio button in a modulator group needs a default setting

Home Forums General Programming Radio button in a modulator group needs a default setting Reply To: Radio button in a modulator group needs a default setting

#118976
dnaldoog
Participant
  • Topics: 4
  • Replies: 480
  • Total: 484
  • ★★

Hi Damien,

It’s probably a bug, but you can’t use mouse down functions with uiImageButtons. The label will pick up the mousedown, but not the main body of the image button.

What I do sometimes is have an invisible uiButton sitting above in a separate layer. If you do this though, you won’t see the button image changing (like a red light on etc) so if you want all the visuals then you have to use a called when modulator value changes function which means the lua will be always firing ( which could create an infinite loop ) as was discussed here ctrlr.org/forums/topic/lua-scripts-in-positive-feedback-loop/ recently, so a redesign/rethink would be necessary.

In your code if v==ViButComA then is viButComA a variable set to panel:getModulatorByName(“viButComA “)?

If it is, then you are comparing a string ‘v’ to an object. Would need to be if v == "ViButComA "

Also, I don’t think setModulator() can take a boolean – needs to be an integer.

panel:getModulatorByName(v):setModulatorValue(false, false, false, false) -- Set all other modulators to false

but better to use:

panel:getModulatorByName(v):setValue(0, false,)I think

And also, the if / else is not necessary in that loop, because you are running through each element anyway, so something like:


for i,v in ipairs(t)do

	panel:getModulatorByName(v):setValue(0, false)	-- Set all other modulators to false
	
-- not sure about what the above achieves
	
panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, i-1, 0xf7})) -- Press Button
panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0x08, i-1, 0xf7})) -- Release Button
		console("Unit Button Pressed"..toString(v))
end

?

  • This reply was modified 6 months, 3 weeks ago by dnaldoog. Reason: typos etc
Do NOT follow this link or you will be banned from the site!