How to change a memory tag value when un item on the horizontal menu is touch

I would like to change a varible in memory when I press an item from the horizontal menu bare. What is the best way to do it. With this variable I will make visible and invisible buttons of the left menu.

Use the onItemClicked component function of the Horizontal menu.

Thank You, do you have a exemple link for that solution, is it done with a event script ?

You would set the value as part of the script action attached to the event.

if event.enabled:
    self.custom.lastClickedTarget =