Are you using a menu anchor for this? Because that’s how it would normally be done.
Apart from that - unsure how the item hierarchy is set up but it would be a general matter of:
- have a list of possible actions (enumerators, most likely) stored in the item, per class. It can be a
setor anarrayif order is important - when you populate the anchor (or whatever container you’re using), do so using the item’s list, piping the data into the dynamically created widgets
- the widgets can dispatch the clicked action to whichever actor is supposed to process it
Again, depending on how you handle inheritance vs interfaces, a dispatcher may be less desirable and interface messaging the actor could work better.
