3 ms·
The one place this style has been handy (for me) was managing gui actions. Imagine some code to save a file. That code should be activated on a few different ev
by jfoutz 10y ago
The one place this style has been handy (for me) was managing gui actions. Imagine some code to save a file. That code should be activated on a few different events, CTRL-S, File -> Save, perhaps a save icon on a toolbar. You want a 4 way associative set. A key event comes in, lookup the action for that event in the table, SELECT action FROM bindings WHERE key=CTRL_S; (or whatever). I didn't really use a database, but it gets the concept across.
This style makes it really easy to dynamically add buttons for actions, verify you've got shortcut keys for different actions, things are hooked up in menus, things like that.
IMHO, it's of limited value. On the other hand, any time you've got several maps that all need to stay in sync something more table like is really nice. A map and it's inverse, several maps all pointing at the same values, things like that.