Using a menu to allow user presets

Andrew Finch
Member Posts: 17 Newcomer
Hi Guys,
I am working on an instrument at the moment and am trying to have a menu that lets you choose between 6 presets that when selected let you choose the states of 4 buttons for that preset. Looking at the code below, I could just create 6 x 4 buttons and hide the ones I am not using when I select a certain preset but I think I remember reading somewhere that there is a way to do the above by only declaring 4 buttons (not 24!). Is there any way to remember the button states for each preset if I am only declaring 4 buttons?
Thanks in advance
on init set_script_title("Menu Buttons") set_ui_height_px(100) {-----------------Buttons--------------------} declare ui_switch $button1 move_control_px($button1,220,40) set_control_par(get_ui_id($button1),$CONTROL_PAR_WIDTH,20) set_control_par(get_ui_id($button1),$CONTROL_PAR_HEIGHT,20) set_text($button1,"") declare ui_switch $button2 move_control_px($button2,240,40) set_control_par(get_ui_id($button2),$CONTROL_PAR_WIDTH,20) set_control_par(get_ui_id($button2),$CONTROL_PAR_HEIGHT,20) set_text($button2,"") declare ui_switch $button3 move_control_px($button3,260,40) set_control_par(get_ui_id($button3),$CONTROL_PAR_WIDTH,20) set_control_par(get_ui_id($button3),$CONTROL_PAR_HEIGHT,20) set_text($button3,"") declare ui_switch $button4 move_control_px($button4,280,40) set_control_par(get_ui_id($button4),$CONTROL_PAR_WIDTH,20) set_control_par(get_ui_id($button4),$CONTROL_PAR_HEIGHT,20) set_text($button4,"") {--------------Menu---------------} declare ui_menu $preset_menu add_menu_item($preset_menu,"P1",0) add_menu_item($preset_menu,"P2",1) add_menu_item($preset_menu,"P3",2) add_menu_item($preset_menu,"P4",3) add_menu_item($preset_menu,"P5",4) add_menu_item($preset_menu,"P6",5) move_control_px($preset_menu,320,40) set_control_par(get_ui_id($preset_menu),$CONTROL_PAR_WIDTH,40) end on
0
Answers
-
You would use an array that holds the preset states for your buttons, then read from that array and set the button values appropriately.
0
This discussion has been closed.
Back To Top
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 63 NI News
- 795 Tech Talks
- 4.1K Native Access
- 16.7K Komplete
- 2K Komplete General
- 4.4K Komplete Kontrol
- 5.8K Kontakt
- 1.6K Reaktor
- 385 Battery 4
- 853 Guitar Rig & FX
- 431 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.4K Traktor
- 7.4K 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