vendredi 5 mars 2021

How to save command pattern commands on a button?

I have an app where I want the user to be able to select from a list of possible actions and ascribe them to a button, i.e. button a call mom, slider b sets a timer... etc..

I've built a load of command classes and my buttons / sliders have a command 'slot' following the command pattern.

But how do I save the users selection? My persistent data is in JSON, what would I store in JSON? Some kind of reference to the class name?

In command pattern tutorials, the example is often given of it's use on context menus allowing the user to assign actions to menu options but they never mention how the user selection is actually saved.

Aucun commentaire:

Enregistrer un commentaire