Can I deactivate a activated Button when a other one gets activated?
treynterrio
Member Posts: 64 Member
Hi there, can I deactivate a activated Button when a other one gets activated?
I need to do this with a 5 different Buttons, when for example Button 2 is activated and I activate Button 5 the second one should be deactivated and so on.
Tagged:
0
Comments
-
Change button names and numbers as needed
on init declare $i declare ui_button $button0 declare ui_button $button1 declare ui_button $button2 declare ui_button $button3 declare ui_button $button4 declare %buttonIds[5] := (get_ui_id($button0), get_ui_id($button1), get_ui_id($button2), get_ui_id($button3), get_ui_id($button4)) declare const $buttonIds__SIZE := 5 end on on ui_control($button0) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button0 := 1 end on on ui_control($button1) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button1 := 1 end on on ui_control($button2) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button2 := 1 end on on ui_control($button3) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button3 := 1 end on on ui_control($button4) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button4 := 1 end on
0 -
THANKS!!! that's exactly what I needed!
But how I can deactivate the buttons now? One of them is now activated the whole time.
0 -
Add an if statement in the callbacks:
on ui_control($button0) if ($button0=1) $i := 0 while ($i<num_elements(%buttonIds)) set_control_par(%buttonIds[$i],$CONTROL_PAR_VALUE,0) inc($i) end while $button0 := 1 end if end on
1
This discussion has been closed.
Back To Top
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 61 NI News
- 773 Tech Talks
- 4K Native Access
- 16.4K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 376 Battery 4
- 835 Guitar Rig & FX
- 425 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.7K Maschine
- 7.2K Traktor
- 7.2K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators