Idea: wouldn't it be cool if dict.view were editable?
What if I wanted to add or replace some of the parameters in a dictionary, and I could just click in whatever line I want to change in here and it would become editable, and when I clicked outside it, it could pass that change to the dict object it's connected to? It looks so much like it wants to be UI for dict objects, would Cycling74 consider adding this functionality to dict.view?
This has been on the Max Wishlist for years now. I'll add my voice here to this request as I make extensive use of dictionaries in my work and would love to see dict.view become an editable interface to its parent dict.
I agree, a dict.edit object, or similar capabilities in dict.view would be very useful.
We have [dict.codebox] since Max 9 which allows just that. But without the fancy foldable keys like in dict.view.
Thank you - I updated recently and didn't see that.
A related question: is there a mechanism that notifies the user (either within the Max patcher or in the js context) when the dict has been edited via dict.codebox?
is there a mechanism that notifies the user (either within the Max patcher or in the js context) when the dict has been edited via dict.codebox?
Not that I'm aware of, and it's the same logic for [dict] in general. [dict.view] and [dict.codebox] automatically update what you see on screen when the dict they're linked to is updated, but there's no way to get a bang out of this update. It's fine for [dict] as you most likely have some patching involved into updating the dict, so you can get your 'update bang' from here, but for editing with keyboard in [dict.codebox], I see no other solution than polling sadly.
Ok, I've figured out a workaround. You can have pattr observe the dict and store its state in a pattrstorage slot, with [pattrstorage] @outputmode set to 6. Then when you edit the dict (I'm using the "edit" message to a generic dict in this case) and close the edit window you'll get a message out of pattrstorage showing the change, which you can use downstream as needed.
For some reason the change notification happens twice, but this is a usable alternative. In my use case polling isn't ideal.
Oh nice!
Turns out you can do it in an even simpler way by just attaching the middle outlet of a [pattr] object to your [dict] or [dict.codebox] and its left outlet will output the name of the dictionary when it gets updated!
Nice!