Multi Group Purge With Menu

2»

Comments

  • theodorech
    theodorech Member Posts: 73 Member

    You can’t use the purge code within a function. You’ll need a different trick for that but you’d simply use your purge code inside your menu callbacks (including previous and next buttons).


    Check this old post for more info on next/prev menu buttons: click here

  • MTC84
    MTC84 Member Posts: 71 Member
    edited July 2024

    Thanks. I did add the code as you said. It works but now the menu only cycles 1-20 and not 1-40 using the Prev + Next buttons.

    The link to the old post didn't work. I'll have a search.

  • theodorech
    theodorech Member Posts: 73 Member

    I don't know why the link wasn't attached.

    Anyway, here's a quick example of what you're looking for:


    on init
    declare ui_menu $my_menu
    make_persistent($my_menu)
    declare $i
    $i := 0
    while ($i<10)
    add_menu_item($my_menu,$i+1,$i)
    inc($i)
    end while
    declare ui_button $prev
    declare ui_button $next
    end on on ui_control($next)
    if ($my_menu<(10-1))
    set_control_par(get_ui_id($my_menu),$CONTROL_PAR_VALUE,$my_menu+1)
    end if
    set_control_par(get_ui_id($next),$CONTROL_PAR_VALUE,0)
    end on on ui_control($prev)
    if ($my_menu>0)
    set_control_par(get_ui_id($my_menu),$CONTROL_PAR_VALUE,$my_menu-1)
    end if
    set_control_par(get_ui_id($prev),$CONTROL_PAR_VALUE,0)
    end on

  • MTC84
    MTC84 Member Posts: 71 Member
    edited July 2024

    Thanks a lot. I did post yesterday to say I had found the answer. Not sure why it hasn't added to the discussion. Maybe my PC had a moment.

    I'm all sorted now thanks to you folks.

This discussion has been closed.
Back To Top