Something similar to the following should do the job in most cases:
Lets say you had an event handler onMyEventOccurs:
void onMyEventOccurs() {
menuMyItem.setVisible(false);
// any other structural changes to the menu
menuMgr.notifyStructureChanged();
}
But to capture the button click from the encoder, as I said the other day in the issue, your use-cases are slightly outside what the default input plugin supports, you'll need to manually handle the input as per
https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/tcmenu-plugins/customise-menu-input-display-plugin/ and
https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menumanager-and-iteration/#controlling-the-menu-items-manually as by default it is assumed tcMenu has control of input unless you take over the display.
Let me know if it doesn't work and I'll take a look, but normally this should work because the rendering facilities are listening for structure change events.