Multi Grp Select by Menu + Prev Next Buttons

Options
MTC84
MTC84 Member Posts: 71 Member

Hi,

I want to add buttons for Previous and Next to toggle through the preset menu but I'm not sure how to do this exactly.

The basic menu script below works as it should (menu item 1 selects groups 0, 1 + 2) but the buttons are not coded fully yet. I have done this succesfully in another UI using a different method but it was for single group selections rather than mulitple groups (multi mic style).

Can anyone help with coding the Prev + Next buttons please?

Thanks.

on init
	make_perfview {makes the UI visible outside edit mode}
	declare const $UI_HEIGHT := 578
	set_ui_height_px(578)

{PRESET MENU CONTROLS}

	declare ui_menu $PRESET_MENU
	move_control_px($PRESET_MENU, 20, 62)
	set_control_par(get_ui_id($PRESET_MENU), $CONTROL_PAR_WIDTH, 183)
	add_menu_item ($PRESET_MENU, "NAME_1", 0)
	add_menu_item ($PRESET_MENU, "NAME_2", 1)
	add_menu_item ($PRESET_MENU, "NAME_3", 2)


{PRESET MENU - PREV + NEXT BUTTONS}

	declare ui_switch $PRESET_MENU_PREV_BUTTON
	move_control_px($PRESET_MENU_PREV_BUTTON, 218, 57)
	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, 40)
	set_control_par(get_ui_id($PRESET_MENU_PREV_BUTTON), $CONTROL_PAR_WIDTH, 40)
	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, 262, 57)
	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, 40)
	set_control_par(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_WIDTH, 40)
	set_control_par(get_ui_id($PRESET_MENU_NEXT_BUTTON), $CONTROL_PAR_TEXTPOS_Y, 1000)
	make_persistent($PRESET_MENU_NEXT_BUTTON)
end on


on note
	select ($PRESET_MENU)
	case 0
	disallow_group ($ALL_GROUPS)
		allow_group (0)
		allow_group (1)
		allow_group (2)

	case 1
	disallow_group ($ALL_GROUPS)
		allow_group (3)
		allow_group (4)
		allow_group (5)

	case 2
	disallow_group ($ALL_GROUPS)
		allow_group (6)
		allow_group (7)
		allow_group (8)
	end select
end on

Best Answer

  • MTC84
    MTC84 Member Posts: 71 Member
    edited May 2022 Answer ✓
    Options

    I figured it out through some trial and error. The following was the key piece I needed.

    on ui_control($PRESET_MENU_PREV_BUTTON)
       $PRESET_MENU := ($PRESET_MENU + $GROUP_COUNT - 3) mod $GROUP_COUNT
       $PRESET_MENU_PREV_BUTTON := 0
    end on
    
    
    on ui_control($PRESET_MENU_NEXT_BUTTON)
       $PRESET_MENU := ($PRESET_MENU + $GROUP_COUNT + 3) mod $GROUP_COUNT
       $PRESET_MENU_NEXT_BUTTON := 0
    end on
    


Answers

  • MTC84
    MTC84 Member Posts: 71 Member
    edited May 2022 Answer ✓
    Options

    I figured it out through some trial and error. The following was the key piece I needed.

    on ui_control($PRESET_MENU_PREV_BUTTON)
       $PRESET_MENU := ($PRESET_MENU + $GROUP_COUNT - 3) mod $GROUP_COUNT
       $PRESET_MENU_PREV_BUTTON := 0
    end on
    
    
    on ui_control($PRESET_MENU_NEXT_BUTTON)
       $PRESET_MENU := ($PRESET_MENU + $GROUP_COUNT + 3) mod $GROUP_COUNT
       $PRESET_MENU_NEXT_BUTTON := 0
    end on
    


Back To Top