Help with Prev + Next buttons for Menu select with Key Colour change

MTC84
Member Posts: 71 Member
Hi,
I have been struggling to get the Next and Previous buttons to work in conjuction with the key colour change.
I would like the colour change to update when I select a new set of groups using the next and previous buttons. The colour change only happens when I use the drop down menu to select the groups. There are 3 mic positions, hence the use of cases in the "on note" code block to select multiple groups. Each set of samples has a different key range.
Please can someone help? Thanks in advance.
on init make_perfview set_script_title("MIXER") declare const $UI_HEIGHT := 523 set_ui_height_px(523) set_skin_offset(0) message ("") declare ui_menu $PRESET_MENU move_control_px($PRESET_MENU, 102, 72) set_control_par(get_ui_id($PRESET_MENU), $CONTROL_PAR_WIDTH, 120) add_menu_item ($PRESET_MENU, "ALL SAMPLES", 0) add_menu_item ($PRESET_MENU, "SAMPLE A1", 3) declare $counter declare %key_color[128] $counter := 0 while ($counter <= 127) %key_color[$counter] := $KEY_COLOR_BLACK inc($counter) end while make_persistent($PRESET_MENU) read_persistent_var ($PRESET_MENU) {PRESET MENU - PREV + NEXT BUTTONS} declare ui_switch $PRESET_MENU_PREV_BUTTON move_control_px($PRESET_MENU_PREV_BUTTON, 228, 66) set_control_par_str(get_ui_id($PRESET_MENU_PREV_BUTTON), $CONTROL_PAR_PICTURE, "Prev_Button") set_control_par(get_ui_id($PRESET_MENU_PREV_BUTTON), $CONTROL_PAR_HEIGHT, 80) set_control_par(get_ui_id($PRESET_MENU_PREV_BUTTON), $CONTROL_PAR_WIDTH, 80) set_control_par(get_ui_id($PRESET_MENU_PREV_BUTTON), $CONTROL_PAR_TEXTPOS_Y, 1000) make_persistent($PRESET_MENU_PREV_BUTTON) declare ui_switch $PRESET_MENU_NEXT_BUTTON move_control_px($PRESET_MENU_NEXT_BUTTON, 252, 66) set_control_par_str(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_PICTURE, "Next_Button") set_control_par(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_HEIGHT, 80) set_control_par(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_WIDTH, 80) set_control_par(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_TEXTPOS_Y, 1000) make_persistent($PRESET_MENU_NEXT_BUTTON) end on function PRESET_MENU_COLOR $counter := 0 while ($counter <= 127) set_key_color($counter, $KEY_COLOR_INACTIVE) select ($PRESET_MENU) case 0 if (in_range($counter, 20, 110)) set_key_color($counter, $KEY_COLOR_VIOLET) end if case 3 if (in_range($counter, 48, 98)) set_key_color($counter, $KEY_COLOR_BLUE) end if end select inc($counter) end while end function on persistence_changed call PRESET_MENU_COLOR end on on ui_control ($PRESET_MENU) call PRESET_MENU_COLOR end on {ON UI CONTROLS - NEXT PREVIOUS BUTTONS} on ui_control($PRESET_MENU_PREV_BUTTON) $PRESET_MENU := ($PRESET_MENU + $counter - 3) mod $counter $PRESET_MENU_PREV_BUTTON := 0 end on on ui_control($PRESET_MENU_NEXT_BUTTON) $PRESET_MENU := ($PRESET_MENU + $counter + 3) mod $counter $PRESET_MENU_NEXT_BUTTON := 0 end on {ON NOTE PRESET MENU GROUP SELECT} on note select ($PRESET_MENU) case 0 disallow_group ($ALL_GROUPS) allow_group (0) allow_group (1) allow_group (2) case 3 disallow_group ($ALL_GROUPS) allow_group (3) allow_group (4) allow_group (5) end select end on
0
Comments
-
Insert your PRESET MENU COLOR function also for the Callback of each Switch ($PRESET_MENU_PREV_BUTTON, PRESET_MENU_NEXT_BUTTON) .
Leave a Comment
1 -
Thanks for the help. Everything seems to work as it should now.
0
This discussion has been closed.
Back To Top
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 791 Tech Talks
- 4.1K Native Access
- 16.6K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.8K Kontakt
- 1.6K Reaktor
- 381 Battery 4
- 851 Guitar Rig & FX
- 430 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